This is the thrid of four exercises that were part of the LiveCycle best practices lab at MAX.
Create a shared script object fragment
Open the file: EX3 addressCopy.pdf in Designer
Preview the file with sample data and note the behavior when you check "same as billing". The shipping address values are greyed out and the values are synchronized with the billing address.
- The logic to copy values and to change the appearance of the destination subform is implemented under the
“Same as Billing” checkbox.
- Take the script methods to copy subforms and “grey-out” data, centralize them in a script object
- Create a re-usable fragment from the script object
- Change the form properties so that script changes are not preserved:
Form Properties/Run-time/Preserve scripting change… : Manually
- Open the form in Acrobat, select “Same as Billing”, save, close and re-open the form
- Notice the Shipping address is no longer read-only
- Fix by applying the read-only setting in an initialization script
- Both instances of the country field populate a list of provinces or states. Centralize/share this code.
Solution: EX3 addressCopy (Solution).pdf