In W my last post, I wrote about actions which set the values of form fields. Today, we’ll focus on some interesting applications of this mechanism.
1. The most common one—clearing hidden fields.
As I wrote before, actions which hide or disable a field do not affect its value. Usually (though not always) you want a hidden field to be cleared. To make that happen, you have to add the ‘Clear’ action and associate it with a condition identical to the one that hides the field.
2. Mailing address—copying to inactive fields.
A user specifies the permanent address and the mailing address. We want both those addresses, but we don’t want to make the user enter the same data twice. We create two boxes that allow copying the values of one set of fields to the other:
The “Mailing address” box is disabled after the “The same as the mailing address” checkbox is selected. However, fields inside this box have ‘Copy from field’ or ‘Synchronize with field’ actions that retrieve permanent address values if the checkbox is selected.
3. Changing values for printout.
The form includes the ‘Gender’ field, and the printout includes the statement ‘I, the mother…’ or ‘I, the father’ depending on the selected gender.
Create a hidden field which will store the statement text, and add two actions to it:
- Set value “I, the father…” on condition that option “M” is selected
- Set value “I, the mother…” on condition that option “F” is selected
Obviously, there are lots of other such applications. Be creative!