While we’re looking at LiveCycle Designer, here’s another great new tool that will help you avoid writing potentially long and tedious script. It’s called Action Builder and it’s pretty powerful. You can use it to define actions that will add or remove fields or sections of your form, set field values, change field or background colours, hide or show objects, or set focus to a specific field. All without writing any script by your yourself.
In this example, we want to either show or hide a bunch of credit card fields depending on the Payment option that was selected.
Assuming you have a form with these fields already on them, you would follow these steps (a link to the sample form is below):
Select Tools > Action Builder…
Click the “Add a new action” icon
Set the condition by selecting an object and a corresponding event. You can create multiple conditions with AND/OR operators. But for this example we’ll set only one condition for each action. For the first action, we want a result to be triggered when “Credit Card” has been selected by the end user.
Set one or more results. In this action we want a bunch of fields to become visible.
Create a second action. This time the condition will monitor for when the Credit Card option is NOT selected. When the condition is met, it will trigger several results that will make the fields invisible
Action Builder creates what is called “managed script”. You can see this script in the Change event of the Payment field. You can, of course, edit this script – but it’s not recommended. And if Designer detects any modifications it will assume that you’re taking control and the script will become unmanaged.
Here’s the sample pdf if you want to take a look: Registration.pdf
You’ve created this great form with tons of validations in the various fields to ensure the data that is typed into the field has the correct formatting. Unfortunately, the default behaviour in Acrobat/Reader is to display each validation error separately, one after the other.
You think this is not the best user experience so would like to change it so that all validation errors show up in a single message box. Prior to Designer ES2 this was possible, but involved a considerable amount of script to get the desired behaviour. But now all you have to do in Designer is select File > Form Properties > Form Validation and you’ll see this:
Here you have several options for how you’d like these messages to show up. You can even set colors for the fields that fail validation. If you select the option to combine all messages into one message box, as shown above, it will look like this:
Nice eh? And no need for any scripting. Note there is a limit to the number of messages that will show in a single box.