IWP Hiding Buttons
Version: FM 12 Pro Advanced Client / FM 12 Server
Just wondering if there is a more elegant way to accomplish what I need. I've made it work but it seems like a sledgehammer approach to the problem. I didn't come up with this solution as I've never worked in IWP before, I found it via a web-search.
To hide or display buttons on a web page depending on conditions within fields for that record, the buttons must be click-able to fire a script. I'm using IWP to deliver documents to employees (not all have FM client). Some employees receive "Letters". Letters are informational only and are "No Action Required". Some employees receive "Contracts". Contracts require the employee to electronically sign the contract by clicking an "Accept" or "Decline" button. Once the contract has been accepted or declined, those buttons are removed and replaced with "No Action Required" and another field displays the date/time and status of the electronic signature. Two buttons (accept and decline) must both be displayed at the same time to provide two different selections. When those buttons are not needed they are not displayed and the "No Action Required" graphic is displayed instead.
So I created a global table (tblButtons) which has two fields a Button_Key and a Button_Container. The keys are "Accept", "Delcine" or "No Action Required" and the container fields store a graphic for an Accept Button, a Decline Button, or a No Action Required graphic. The employee record has three calculations, one for each "button", that returns true for only one condition. There are three relationships between the employee table and the button table, one for each condition. On the web page I've added three portals, one for each condition - each portal uses it's own relationship to display the correct button. When the record requires a display of "No Action", the Accept and Decline calculations return false and the "No Action" calculation returns true. The relationship then shows the "No Action Required" graphic. When the record requires the Accept and Decline buttons, those calculations return true and the "No Action" calculation returns false. The web page displays the Accept button in it's portal and the Decline button in it's portal - since "No Action" is false, that graphic is not displayed.
Is there a simpler way in FM 12?