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).
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 data
$record.movie[*]
to the list and then we’ve bound the text items to the
title
data node (which translates to “$record.movie[*].title” since it’s relative to the property’s binding) and the value items to the
showTime
data 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):
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 [*]).
Posted by Stefan Cameron on July 29th, 2006
Filed under Data Binding,Tutorials
Both comments and pings are currently closed.
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?
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.
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.
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.
Hello Stefen,
Some questions on Dynamic Properties:-
1. In Item Text, you use “text” value. This will only display the text description. It does not display the value “key”. Is it possible to display both? That means display like this. “IL – Illinois”. Whereby IL is the Item Value. And Illinois is the Item Text.
2. Created a textfield. This textfield is to display dropdown description. That means displaying the Item Text value. The declaration looks like this. xfa.form.data.#subform[0].DE_Empty[2].DEContent.ISR_TextDisplay.rawValue = xfa.form.data.#subform[0].ISR_DDL_NoSelected.value.#text ;
ISR_DDL_NoSelected is the dropdown. ISR_TextDisplay is the textfield. However, it only display Item Value. It does not display Item Text.
Please advice.
Hope to hear from you soon.
Thank You,
Aaron
Aaron,
In response to your questions:
Hello Stefan,
I am a beginner in Adobe Designer and I have some difficulties to import xml data in a drop down list.
In fact, I work with Adobe Designer 7.0 so I don’t have this dynamic properties.
So to make the binding I try different plans:
1- I create a datasource, I drag on my form the list, in the binding part of the list I choose my datasource with the data wanted. The result is in the preview I have no data ๐
2-I create a datasource, I write script to put xml data when the list is initializing. The result is in the preview I have no data ๐
3-I download your sample and I look how it works. So in a new test, I create a datasource, I drag a list in my form, I put my xml data in file->form properties->details->preview->data file, I add in the xml source of my form the balise BindItems to the field of my list like your sample . The result is in the preview I have my data. ๐ But when I open the pdf in Reader the data are not here. ๐
4-So I take again the first try and I add my xml file in form properties->preview…, like this in the preview I have only the first record ๐
So I have always my problem : how import xml data in a drop down list ? how do to have this data in the pdf in output to read it in the Reader?
Thanks for your response
Best Regards
Michael
Michael,
Unfortunately, even if I explained to you how to import items from XML data into your drop down list without the use of the Dynamic Properties feature in Designer 7.1, you still wouldn’t get anywhere if you’re only using Reader to “run” your form. Reader, on its own, cannot import data. The PDF form that it opens must be extended using Adobe LiveCycle Reader Extensions ES in order to enable Reader’s hidden “data import” feature when that PDF is being used. The reason why you can get this to work in Reader using Designer is because when you specify a preview data file, Designer manufactures a PDF with the data already merged into it prior to giving it to Reader to preview (which means Reader isn’t part of the data import/merge process which it can’t do on its own). When you distribute this form to other users who only have Reader, they’ll have to use Reader to import/merge the data and they won’t be able to do it. That is, unless you’ve extended the PDF.
Acrobat Standard and Professional can import data into a PDF without requiring the PDF to be Reader-Extended.
If you’re able to Reader-Extend your form or if you can use Acrobat Standard or Pro instead of Reader, let me know and we can work at importing the data using script.
Hi Stefan,
Like the other Michael, I am very much a beginner at using Designer 7.0. What I’m trying to do is have two checkboxes, and when either is checked, filling in one of two lists of 7 items into a dropdown list, then having the choice on the dropdown list populate another dropdown list. I would also like to do this without having to link it to an XML source and be usable in Reader. Firstly – is that possible? Secondly – how do I do it?
I have tried going through the FormCalc User Reference, but not being from a programming background, not much of it makes sense! I can get very basic scripts working, such as message boxes appearing, and I have made the dropdown lists and checkboxes, but I can’t link anything.
Hope you can help,
Mike
Mike,
If you aren’t using any kind of data connection, it implies that you’re loading all these list using script. I would recommend you use the Change event of the checkbox objects to execute some script that would populate the right drop down list. To populate a drop down list, you simply use the addItem() method:
You can do this either in FormCalc or JavaScript. I strongly recommend you get used to using JavaScript.
As for populating the second drop down list when a selection is made in the first one, I would script the Change event of the first drop down list, check what the user selected and populate the second drop down list accordingly:
Stefan I am in need of some desperate help.
I am trying to create a small calendar within an interactive form using Adobe FormDesigner 8 where the user can initiate a button click event for that particular day which will cause text and a hidden text box to appear in a text field. I was able to successfully have images appear in an image field with a button click event but cannot get the text to do the same. The JavaScript code that I used for the images is as follows:
Button 1
var image = StaticImage1.value.image.value;
newImage.rawValue = image;
Button 2
var image = StaticImage2.value.image.value;
newImage.rawValue = image;
If you can help me in resolving this matter is quickly as possible, this would be a blessing thank you.
Rob Baptiste,
I dont’ quite understand what you mean by having “text and a hidden text box appear in a text field”. If you’re just trying to get text to appear in a text field, you just need to set the text field’s rawValue property:
Hello Stefan,
I am new to form designing so sorry for simple questions. I am trying to use drop down list to select a name and automatic have the address field like street,city,state, zip filled in. Do you have an example of this?
Thanks much for you help.
Satish
Satish Janardan,
You’ll need to script the drop down list’s Change event in order to accomplish this. Using the “Window menu > Script Editor” command to show the Script Editor palette, choose the “Change” event from the “Show” property and set the language to “JavaScript”.
First, you’ll need to get the new selection in the list:
Then you’ll need to figure-out what it is:
Of course, this assumes that you have fields named “Street”, “City”, “State” and “Zip”.
Hi Stefan,
I’m sure you can help me with my problem which is a bit similar to the previous one: I need to design an interactive purchase order form where the user clicks on a particular button below an image and the corresponding, article number,description and price are automatically entered into the PO Form- Subsequent articles should be automatically entered below the last one. Is this possible? I have already designed a form where this works with a drop down list but it is not user-friendly since one needs to remember the article number to be able to chose from the drop down list and my article numbers run into 100s:-)!
Thanks
Ron
Ronnie,
It’s definitely possible. You could use a table with a repeatable row (select the row and in “Object palette > Binding tab” set it to “repeat for every data item”). Making it repeatable will give you the ability to add/remove instances of the row using its Instance Manager. Once that’s setup, the Click event on a button associated to a product image would add a new instance of the row, get a reference to that new instance (remember, the Instance Manager’s addInstance() method returns a reference to the new instance) and set the instance’s article number, description and price fields with the information pertaining to the related product:
Thankyou so much Stefan!
I think your table method would only work in Designer 8 and above. Is there a way I could possibly do the above (interaction 15.) in Designer 7. Would be great if you could help me out with this!
Thanks
Ron
Ronnie,
Tables are actually just nested subforms. If I recall correctly, tables were introduced in Designer 7.1 but the Instance Manager has been around since the beginning.
A table is essentially a flowed subform that contains other subforms which may or may not be flowed themselves. Each subform in a flowed subform can be repeated and so my sample from comment # 16 would apply to a repeatable subform inside a flowed subform. (Don’t forget to set the “Object palette > Binding tab > Repeat Subform for Each Data Item” property to make the nested subform repeatable.)
Hi Stefan,
Sorry for troubling you once again-but I just don’t seem to get this addinstance() method. I am now working with Designer 8. For my problem in #15, I tried the code you have given in interaction #16 but it doesn’t work-I think the problem lies in referencing the repeatable subforms-which I am probably not doing properly. I am giving the folowing code under the click event of the Button1:
—– form1.Sub1.Subform1.Button1::click: – (JavaScript, client) ———————————–
var newRow = Table1._Row1.addInstance(0);
newRow.ArticleNumber.rawValue = “123”;
newRow.Description.rawValue = “product description”;
newRow.Price.rawValue = “199.99”;
This is my heirarchy:
-form1
-(Master Pages)
-Page1
Untitled Content Area
-Sub1
-Subform1
-Table1
-Header Row
-Cell1
-Cell2
-Cell3
-Row1
-ArticleNumber
-Description
-Price
Button1
(Referenced Objects)
-The Table has been created in Subform1 (Content type has been set to Flowed).
-Row1 has been set to “Repeat Subform for Each Data Itemโ
-Min Count is 1
Would really appreciate your help.
Thanks
Ron
Hi Stefan,
I forgot something-How do I reference the repeatable subform in the Table object, if the button with the addinstance method is on another page (see #15-I wanted to make a Purchase Order with the images of the products and the ‘Buy’ button just beneath it- the user clicks on the button and the product details are automatically entered into the Purchase Order form at the end) ?
Thanks
Ron
Ronnie,
I don’t see anything wrong with your code to add the row. I’m wondering if you saved your form as a static PDF (or if you saved it as an XDP and are previewing it as a static PDF). Static PDFs cannot add/remove instances, show/hide fields, etc.
To check, comment-out the code in your Button1 object’s Click event and put this code instead:
Preview your form and click on the button: If it disappears, then you’ve got a dynamic PDF and there is, in fact, something wrong with your code to add the rows. If it remains visible, then you’ve got a static PDF and that’s the problem.
See my article on previewing as a dynamic PDF to make sure you’re previewing in the correct format.
Hi stefan
iam facing a problem in dropdown list, iam populating it dynamically and it is showing only one value if the list is having more than 50 entries.
is there any restriction for 50 entries.
Thanks in advance
Ganesh
Stefan,
I have been reading through your posts and replies, and I’m very happy that there are folks out there like you. …now that I’ve praised your knowledge, off to me question ๐
I just downloaded the trial version of Livecycle Designer ES 8, and i’m blown away with it’s functionality! I’ve been using our office copy of Acrobat Professional to build cover sheets and service call forms for about a year now. LC should completely revolutionize the way we do business….if i can figure some things out. I’m skilled enough, and willing to waste a bunch of time clicking and poking, to handle text boxes, form layouts and the overall look! I need help with ODBC\OLEDB connections and bindings. If this post goes on for too long, feel free to email me and we can post a simplified version for others to benefit from.
Here is my example:
I have work orders for our engineers. There is a unique ServiceID number, or callID, that is associated to every call that we log for customers. This is for billing and work history. The data is split up between two specific tables in our SQL database, and I’m very familiar with the architecture of the tables and column relationships. The work order sheets are filled out by the engineers, but it is double work. ALL of the data they fill in already exists in SQL, because they use a web console on their phones or PC’s to log times and notes for the call.
For the PDF, i would like to have the user enter the ServiceID\callID and have the form populate the other fields: Customer Name, Number, Date, Time arrived, time departed…and so on. I have already made the connection to SQL, and tested it. I have also already started dragging the Columns from the Data View over to the blank PDF. My question is more about “Best Practice” suggestions.
1. The fields pull some default data that i never entered. How to I configure the field to wait for the user to enter data?
2. The more important question: The table “ftmServiceCalls” does not contain the actual customer Name or Number. It has columns like “AccountID”. “AccountID” is then matched up to the table “ftmAccounts” and can then return values from “AccountName”(customer name) and “CustomerID”(customer number). How to I tell the PDF to take the value that the user enters, pull the “AccountID” from the first table(ServiceCalls) and then match it up to the table “Accounts” to acquire the “AccountName” and “CustomerID” data….? whew! that was long!
my real problem is that there is so much to look at! Object pane on the right, with field, value and binding, dataview on the left with the data connections and the columns, and me in the middle with NO idea how to connect it all. If you want, to clarify the connection with the tables, i have a database diagram i can send you, not that you’ll need it.
THANK YOU SO MUCH for reading all this. I hope to be in touch!
P.S. I don’t have an account here, if one’s needed, so i don’t know if i’ll be able to watch the thread, but i will try. I will be available all times by email.
Hello again!
Like i said, i poke and fiddle till i answer some questions. OK, so I’ve been thinking about what i hope to achieve, and i came up with a very basic SQL Query that shows my request.
I would like to prompt the PDF user to input something like “AccountId”, and have the dataconnection update the form fields with the record info:
SELECT AccountId, AccountName
FROM ftmAccounts
WHERE (AccountId = 14591)
“14591” is the AccountId that i would like the user to input…how do i specify user typed info into a dynamic?
Thanks!
ganesh,
There shouldn’t be a limit — certainly not at 50. How are you populating the list?
Nick Armstrong,
It’s great that you’ve discovered LiveCycle Designer! Sounds like you’ve got an interesting project to work on.
What you need is my tutorial on selecting specific database records.
Now that you’ve figured-out what query you’ll need to execute and the piece that will change (the AccountId), you should be able to get through the tutorial just fine. And if you want the user to simply enter a call/account ID without selecting it from a list (as in the tutorial form), just replace the drop down list with a text field and forget about the first data connection (in the tutorial).
As for the “fields pulling data you never entered”, I’m not sure I follow you. If the field looks like it has a default value and you don’t want it to, just go to the “Object palette > Value tab > Default Value property” and remove it from there.
Hi Stefan,
I’m a photographery on the side and my main job asked me to create some forms using Adobe since I know some of their programs. I’ve been using LiveCycle to create the PDF forms and I’m very impressed with it. The problem I keep smacking against is I cannot figure out how to create a form with expandable fields and text boxes, that push the fields below them down. Normally, people are viewing the reports on a computer, so using the scroll bar to see the additional text isn’t an issue, but I’ve got a number of users who want to print the forms out. When they do, the remainder of the text is missing.
I spoke with a rep at Adobe who seemed to believe there may be a plugin for this. I’ve read that there may be a way to do it in xtml. My problem is I know nothing about programing.
Do you recommend anything? Is there a plug in to allow my forms to expand like this? Thanks, Jason
Stefan,
Thank you for the reply. I read through the “selecting specific database records” post and I can’t seem to connect it to my situation. I really mean that there is so much there, i don’t know where to start to make my example work. I think this is because i don’t understand the terminology that well. I downloaded the PDF sample from that post, but i can’t get it to connect to my version of your movies database. I don’t know how to use FormBuilder, so I copied the names and values into Access, and i get an error from the “dataconnection” wizard. I get an error when i chose SQL Query and i put in:
SELECT id as catId, name AS catName FROM movie_categories
GROUP BY name ORDER BY name;
Error: Could not execute the query: paste in query.
Any chance you could post me a very quick and dirty “how-to” to get the query to change based on a text form field? I understand if this would be too time taking.
Thanks again.
Stefan,
For the SQL Query error, i took out “GROUP BY name ORDER BY name;” and it works fine. I don’t know how it would have acted different, but i’m looking that up on (http://www.w3schools.com/sql/sql_groupby.asp) for examples.
I will work with your example to try and learn by back stepping, but i think i would benefit greatly from a “how-to” like i posted above.
Thanks!
Stefan,
Thank you for a great website. I have question regarding your post above.
I was wondering if you could tell me how I can use a drop down list to select an Actor from your movieData and then show all the movies that actor is associated with in a second drop down list. Which would then display the time for that movie in a text field.
I would like to limit each drop down to a unique value. Is this possible?
Thanks for your help.
Paul
Stefan,
Ok, i’ve been looking more at your “selectspeficifDBRecord.PDF” and the post. What do you mean in the spots i’ve highlighted with *****
First, get the category selected by the user and determine itโs associated ID:
var sCategoryName = xfa.event.newText
var sCategoryId = $.boundItem(sCategoryName)
Given the XML structure of the (sourceSet> packet displayed above, ******you first set the queryโs command type to โtextโ:*****
(just put this in the FormCalc script?): xfa.sourceSet.MoviesInCat.#command.query.commandType = “text”
This ensures that the data connection will use an SQL statement. Note the pound (#) prefix to the command property of the MoviesInCat node.
Then, set the SQL statement, on the MoviesInCat data connection, which will filter the records from the movie table in order to show only those that belong to the selected category:
******xfa.sourceSet.MoviesInCat.#command.query.select =
concat(“SELECT title, showTime FROM movies WHERE categoryId = “,
sCategoryId, ” ORDER BY title;”)***?? (can i just replace the “showTime” and “movies” with my appropriate tables and columns?)
thanks
Jason Sipman,
To get fields to expand to fit their value, you have to set their width and/or height to “expandable” by checking the box at “Layout palette > Width/Height > Expand To Fit”.
Also, you have to make sure that the expandable fields are inside subforms that have flowed content (“Object palette > Subform tab > Content Type property” set to “Flowed”) otherwise objects below the expandable fields won’t flow downward to accommodate the new height of the fields.
Paul,
Just take my tutorial on selecting specific database records and change the first data connection’s query to return a list of actors instead of categories and then change the second dynamically-generated query (for the second data connection) to filter on actorId instead of categoryId.
Nick Armstrong,
Yes, just put
in your code but keep in mind that “MoviesInCat” must be replaced by the name of your data connection.
As for the second statement, it’s building an SQL Query statement using FormCalc’s concat function which takes a series of arguments and concatenates them into a single string. In this case, the string is then assigned to the MoviesInCat data connection’s <select> node which specifies its query statement.
Note that your data connections should use your tables…
Also, if you’re doing this with Designer/Acrobat 8.0 or later, you’ll need to first clone the data connection (only the second one that you modify at runtime), then set the query, as demonstrated in my post on better form design with XFA 2.5.
stefan
thanks for the reply for this listbox showing only 50 values, iam populating the list from the badi.
but this is solved as in the basis settings the node is restricted to only 50 values,now it is made 500 and i can see 500 values.
but now i have two drop down list boxes and based on the first list box value i have to show the 2nd list box values. my problem will be solved if i can call the backend badi after the first value is selected, can you please tell me what script i have to write.
thanks in advance
ganesh
ganesh,
I’m not sure what you mean by ‘badi’. In any case, you’ll probably want to use a Change event script on the first listbox which gets the selected value and populates the second listbox accordingly:
Hi, Stefan
Have you any idea how to populate drop-down list from attached XML schema element enumerations. I use Altova products to deal with XML and I definetly know that Altova StyleVision can do in that way
thanks
Alex,
If your schema defines an element that can contain a predefined list of values, creating a data connection based on that schema should give you a node which, when dragged onto your form, produces a list box or drop down list object with the items already created.