Destroying a field at runtimeAdded by IBM on November 28, 2011 | Version 1 (Original)
|Use the destroy function to delete a field in response to user activity. The "destroy" function can also delete form items such as buttons, labels, and pages.
Use the destroy function to delete a field in response to user activity. The "destroy"
function can also delete form items such as buttons, labels, and pages.
Some restrictions apply when deleting most items. See the XFDL Specification
for more details.
In this example, FIELD1 is deleted from the form when the user clicks on CHECK1.
To delete a field in response to user activity:
Parent topic: Action Editor
- Select Check from the Palette and drop it into the form.
For this example, no changes to the Properties window are required. Click OK to close the Properties window. Now, add two Entry Fields to the form.
- Select Entry Field from the Palette and drop it into the form.
- Click OK to close the Properties window.
Repeat steps 3 and 4 to add the second field.
- Right-click on the check box and click Action Editor -> Custom Action Editor.
The Action Editor window opens.
- Click Quick Start and from the menu, click On Value Change.
The Action Editor displays the On Value Change template, and highlights the word "newValue."
toggle(value, '', 'newValue') == '1' ? action : ''
- Click in the first set of empty brackets and type off.
- Select "newValue" and type on.
- Select "action" and clickFunction.
The Action Editor | Function menu opens
- Go to Utility -> destroy.
The destroy menu appears and the reference parameter is highlighted.
- Click Form Item.
The Function menu minimizes to display the items on the form.
- Select the second field from the form.
The name of the field appears in the Selected Form Items window. The value option is highlighted.
- Click the dropdown menu beside value, scroll to the top of the menu to select the blank option above acclabel. Click OK to return to the Function menu.
- Click type from the Parameter window.
- Type item in between the single quotation marks and click OK to return to the Action Editor window
The completed action should appear as follows::
toggle(value, 'off', 'on') == '1' ? destroy('PAGE1.FIELD2', 'item') : ''
- Click OK to apply the action and close the Action Editor window.
- Click the Viewer tab to test the action. When the check box is selected, the second field is destroyed and disappears from the form.