I wonder if someone can help me.
I have a table where users will enter values into a text field in one of the columns. Users will be able to add or delete rows in the table. I want to use the values that are entered into the cells in that column to create a drop down list in a cell in another table. I've been able to pull values from text fields into text fields in other tables before but I'm not sure how to go about creating a drop down list.
Any help much appreciated.
Views
Replies
Total Likes
You woudl create your empty Dropdown list (lets call it DDList). Then when you want to add something to it you woudl use DDList.addItem(Item to Add). So if you have Field1 that you want to add to the list you woudl use: DDList.addItem(Field1.rawValue)
Paul
Is there anyway of using script to access that value list? I populate a DDL in a dynamic table row using additem, but when I add a new row using script that duplicates the previous row, the DDL values aren't duplicated. So, somehow I need to recreate the value list in the new DDL in the new row.
Views
Replies
Total Likes
You can create a script object which will populate the Dropdown by using the addItem method.
Then in the Initialize event of the dropdown call this function to populate the field.
That way when you create a new row, the initialize event will be called and the dropdown will be populated.
Thanks
Srini
Views
Replies
Total Likes
Thanks for the suggestion, how do I reference the value list of another DDL object in order to duplicate its value list? I know how to use addItem(); just not sure how to access (or reference) the other DDL's value list to loop through to get it to populate the new DDL with the same value list.
Views
Replies
Total Likes
I'm struggling to get this to work correctly. My knowledge of Javascript is somewhat limited..
I have put the following script under both the Exit and Initialize event in the text field of the first table:
Registered.Details.Table.Row1.Entity.addItem(Entities.Table.Row1.LegalEntity.rawValue)
It works fine if I only have one row in both tables but as soon as I add another row to the first table the drop down list contains 3 items all of the value from the first row in the first table rather than 1 of the value from the first row and 1 of the value of the second row. Basically I need to get the values from everything in column 1 of this table into the drop down list without knowing how many rows there are likely to be.
I also have the problem in that I need to duplicate the drop down list in the new rows that may be added to the second table. I've tried entering the same script in the Initialize event of the drop down list but that's not working. I've also tried adding it to the click event of the button to add new rows and I can't get it to work that way either.
I'm probably entering the scripts in all the wrong places - where should they go?
Also if someone deleted a row from the first table would the value in the drop down list also be deleted?
Views
Replies
Total Likes
Hi,
If you can send me your example I can take a look and see if I can work it out.
Kind regards,
David
Views
Replies
Total Likes
Thank you for your offer of help. As attaching documents has been disabled would it be ok for me to email it to you?
Views
Replies
Total Likes
Finally managed to get this to work with David's help. Solution if anyone else needs it:
Create a function - Form1.formScripts:
function populateColumn4(){
// get the numbers of rows in both tables.
var srcRow = form1.Top.Questions.Table1.Table1.Details.Row1;
var srcRowCount = srcRow.instanceManager.count;
var destRow = form1.Top.Questions.Table1.Table2.Details.Table.Row1;
var destRowCount = destRow.instanceManager.count;
// cycle through the dropdown in each of the destination rows and empty their list.
for (var j=0; j < destRowCount; j++) {
xfa.resolveNode("form1.Top.Questions.Table1.Table2.Details.Table.Row1[" + j + "].Column4").clearItems();
// Now fill the drop down on the current destination row with each of the values in the source row.
for (var i=0; i < srcRowCount; i++) {
var fieldValue = xfa.resolveNode("form1.Top.Questions.Table1.Table1.Details.Row1[" + i + "].Column1").rawValue;
xfa.resolveNode("form1.Top.Questions.Table1.Table2.Details.Table.Row1[" + j + "].Column4").addItem(fieldValue);
}
}
}
Here's the sample file - https://acrobat.com/#d=0XRvfKXxwoXnS0iT3JkyUw
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies