When I click the "Add Affiliation" button, I would like it to add the item number associated with that particular subform row added to the listbox below it. I calculate the item number from the index (the text field is called "txtCalcItemNumber").
This is what is in my click event for btnAddAffiliations:
Page1.Affiliations.Details.instanceManager.addInstance();
(i tried the code below to add items to listbox but doesn't work)
var values = xfa.resolveNode("Page1.Affiliations.Details[" + this.parent.index + "]").txtCalcItemNumber.rawValue;
ListBox1.addItem(values);
THANKS FOR YOUR HELP!!
Solved! Go to Solution.
Views
Replies
Total Likes
Try this out
Views
Replies
Total Likes
ListBox1.addItem(values, values);
the method addItem needs to param;
1st: Display Value
2nd: Bound Value
you can also set the bound value as an index
ListBox1.addItem(values, ListBox1.length);
Views
Replies
Total Likes
Thank you for your reply
Just tried adding the bound value and code is still not working right
Views
Replies
Total Likes
ok.. euhmm the other thing i can think of would be converting index into string
this.parent.index.toString()
Views
Replies
Total Likes
Still nothing :/
Here is the form in case you would like to look at it
Views
Replies
Total Likes
Yea i would, but the link ain't working
Views
Replies
Total Likes
Try this link and see it if works. Be sure to click the blue download button
https://files.acrobat.com/preview/0a09eddd-6d7a-435c-8fa7-bb2dd3ef857a
Views
Replies
Total Likes
Try this out
Views
Replies
Total Likes
Awesome! I tried it out and seems to work
One other thing (forgot to mention), is it possible to have the List Box have 1 as the initial number (since there is already 1 affiliation visible on the screen) and then when you click to add another affiliation, it places 2 in the List Box, etc.. Does this make sense?
Thank you for your help!
Views
Replies
Total Likes
Yes, just add an itme in the listbox in the object palette, and then in the code,
when u add the item in ur listbox, add 1 to your value...
or
Views
Replies
Total Likes
Hi Robert,
I appreciate your help! I tried the following code and I seem to keep getting "1" added. I have attached my updated file to show you what I mean.
https://files.acrobat.com/a/preview/0a09eddd-6d7a-435c-8fa7-bb2dd3ef857a
Thanks again!
Views
Replies
Total Likes
okay, cuz ur values are strings, we can't add 1 to it or else it will concatenate both value as strings
so you need to convert the string to int value like this
AffiliationListBox.addItem((parseInt(values) + 1).toString(), (parseInt(values) + 1).toString());
Views
Replies
Total Likes
Thank you for all your helpful information!!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies