I have designed a form based on the example in the Terry book of using javascript with addInstance to make a button add a row to a table.
Works fine for me however I am trying to morph the form a little so that instead of allowing the user to click the add row button I have them enter a numeric value in a field and then call addInstance to create the correct number of rows. The numeric field is on page 1 of the form and is called NumberStudents and is bound as Global. I tried to have it call addInstance to add rows but cannot get it to work. Suggestions appreciated. Newbie thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
The only mistake you did was missing rawValue next to the control name "NumberOfCards"
var i=0;
for
(i=2;i<=NumberOfCards.rawValue;i++){
Roster.Page2.StudentSubform.Table1._Row1.addInstance(1);
xfa.form.recalculate(1);
}
If your requirement is add the number of rows based on the value entered in the numeric field, you can so by calling the setInstances method. This way you do not need to loop thru the number and use the addInstance every time.
Roster.Page2.StudentSubform.Table1.Row1.instanceManager.setInstances(5);
xfa.form.recalculate(1);
or
Roster.Page2.StudentSubform.Table1._Row1.setInstances(5);
xfa.form.recalculate(1);
Thanks
Srini
Views
Replies
Total Likes
Can you post your form
Thanks
Srini
Views
Replies
Total Likes
I can post the form. Where to?
Views
Replies
Total Likes
goto acrobat.com website
login with your Adobe login/password.
In Actions you will find Upload. Select your form and upload.
After uploading, select form name in All Files section and right click and select share.
Check the checkbox "Allow anyone with a link to view this document".
Copy the URL link and post it in the forum.
Thanks
Srini
Views
Replies
Total Likes
Views
Replies
Total Likes
The only mistake you did was missing rawValue next to the control name "NumberOfCards"
var i=0;
for
(i=2;i<=NumberOfCards.rawValue;i++){
Roster.Page2.StudentSubform.Table1._Row1.addInstance(1);
xfa.form.recalculate(1);
}
If your requirement is add the number of rows based on the value entered in the numeric field, you can so by calling the setInstances method. This way you do not need to loop thru the number and use the addInstance every time.
Roster.Page2.StudentSubform.Table1.Row1.instanceManager.setInstances(5);
xfa.form.recalculate(1);
or
Roster.Page2.StudentSubform.Table1._Row1.setInstances(5);
xfa.form.recalculate(1);
Thanks
Srini
Views
Replies
Total Likes
Thanks. That was it.
Views
Replies
Total Likes
I want to do something like this - however - is there a way to not have the page 2 "student" rows disappear - but create a new page, instead???? Also, why did you create page 3?? If I am looking at it correctly - page 3 is like page 2 but with no Add student button??
Thanks
Christina in Tucson
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies