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 [ == * == ]).

4 Responses to Dynamic Properties

  1. Raf says:

    We’re using this ‘dynamic properties’ feature for translations of our forms. All captions, dropdownboxes, etc are filled dynamically.I always found it very strange that almost all interactive form objects have dynamic properties, except the radiobutton! It seems that the only way to fill the caption of a radiobutton is by using custom scripting? Will this be covered in the next version of Designer?

  2. Raf,That’s an interesting idea and I’m sure it would be very useful!The fact is that there are still many field properties to which the Dynamic Properties feature could be applied. We just didn’t have time to implement them all the first time around.I’ll submit an enhancement request for using the Dynamic Properties feature to set the caption of a radio button and will update this post if it ever gets implemented.

  3. Bob Banik says:

    I am having a problem when creating a List Box using the Dynamic Properties feature. I am able to generate a List Box with LiveCycle Designer showing the Item Text but not the Item Value. I have tried several combinations of variables, but with the same result that only the Item Text is displayed in the PDF form.Can you suggest what I should do to display both the Item Text and Item Value in the form after importing XML data source ?Thanks in advance.

  4. Bob,By definition, a list box has two types of items: text and value.If only text items are supplied, then the value of the list box is set to the text item which gets selected and which is also displayed.If both text and value items are supplied, the text items are visible and the value items are always invisible. When an item is selected, the list box’s value is set to the value item which corresponds to the text item that was selected.If you want to see the value items in the list using the Dynamic Properties feature, you would either have to map the value data to the text items and use only text items in the list box (where the list box’s value is the same as the selected item’s text) or the application generating the XML data would have to combine the text and value data nodes into a single data node so that you could map it to the text items.Another alternative would be to write a script in the list box’s Initialize event which would re-arrange the list items such that the text items contain the text and value combination and the value items remain unchanged. Since the Initialize event occurs after the data has been merged with the form, the list will be populated with your XML data when the Initialize event occurs.You could achieve this using the new List Object Properties and Methods if you’re using Designer 8.0.