Dynamic Properties

Did you know that as of Designer *7.1*, there’s way to automatically populate certain field properties with data _without having to write any script_? This is what the new *Dynamic Properties* feature is designed to do.

First, you have to enable it because it’s disabled by default. You can do this by going to the Data Binding panel in the “Tools | Options” dialog. There, you’ll find a check box labeled, “Show Dynamic Properties”. Check the box and press OK. After doing so, put a list box (for example) on the form and take note of the changes in the Object palette’s Field, Value and Binding tabs.

You’ll notice that some property labels have now changed color (default is green) and are underlined. You can now click these property labels to make the properties they pertain to dynamic (i.e. to automatically push values into them when data is loaded into the form via a certain data connection that you specify). For instance, the Field tab now has dynamic _Caption_ and _List Items_ properties.

If you click on the List Items label, you’ll get the following dialog (this screen shot shows the properties already configured for this sample):

== ==

Using the Dynamic Property dialog (above), you can then specify the data connection from which the data will be loaded and also the data node(s) that will contain the data (in this case, for a list field, you can bind data nodes to the text and value items of the list).

“Download Sample [zip]“:http://blogs.adobe.com/formbuilder/samples/DataBinding/DynamicProperties.zip

*Minimum Requirements:* Designer 7.1, Acrobat Pro 7.0.5

*Note:* If you open the form in Acrobat, don’t forget to import the data into it using the “File | Form Data” menu.


For this sample, we’re trying to list all the movie titles and, when a movie is picked from the list, display its show time in a date/time field on the form. Therefore, we’ve bound all movie databc. $record.movie[*]to the list and then we’ve bound the *text* items to thebc. titledata node (which translates to “$record.movie[ == * == ].title” since it’s relative to the property’s binding) and the *value* items to thebc. showTimedata node (which translates to “$record.movie[ == * == ].showTime”).Based on these settings for the list’s text and value items, the list will be automatically populated with all movie titles and show times when the movie data is imported into the form. *All this without having to write a single line of script!*By the way, if you’re curious about the script you would have to write in order to do the equivalent without using the Dynamic Properties feature, just drop a “Data List Box” or “Data Drop Down List” object, from the Library palette’s Custom tab, onto the form and have a look at the script in its Initialize event. Now that’s not simple script! Of course, there are advantages to using script over Dynamic Properties because script is more flexible but in this case, there’s really no need to worry about using script.Once you’ve filled-in the properties inside the Dynamic Properties dialog for the list box’s _List Items_ property, you’ll notice that the property’s label now has a little “link” icon to signify that the property is bound to nodes in a data connection:== ==Finally, you just need a single line of script in the list box’s Change event to display a selected movie’s show time in a field on the form (in FormCalc):bc. ShowTime = $.boundItem(xfa.event.newText)Please note that the Dynamic Properties feature is still in its early stages therefore it only handles simple data binding situations like the one for this sample. Many customers who’ve discovered this feature attempt to use it in dynamic subforms in order to populate lists with data pertaining to the current record and soon discover that the lists always end-up containing *identical* record data when they use the Dynamic Properties feature. That’s because the feature simply doesn’t yet support dynamically updating the data node occurrence which is used to populate a list, for example (that is, updating the occurrence of the “$record.movie” binding to a specific occurrence as opposed to always using [ == * == ]).