I would like to add a specific number of subforms based on what a user enters into a numerical field. So, if the user puts in 4, four instances of the subform would be created. How can I do that?
I guess I should have waited to post. I figured this part out.
I created a button with this in the click event:
xfa.form.assessment.Questions.Questionset.Questiondetail.FIBdetail._blanks.count=assessment.Questions.Questionset.Questiondetail.FIBdetail.totalblanks.rawValue
So, now what I want to do is number each instance. I have this in the initialize event of the subform:
var cnt = assessment.Questions.Questionset.Questiondetail.FIBdetail.blanks.instanceIndex + 1;
xfa.resolveNode("assessment.Questions.Questionset.Questiondetail.FIBdetail.blanks.blanks.caption.value.#text").value = cnt + ":";
However, they are all numbering as "1" right now.
What can I do to make them number sequentially?
Views
Replies
Total Likes
Using javascript put the following on the calculate event of the field you want the number displayed in:
this.rawValue=this.parent.index+1;
Thanks for your help. I need the value to end up in the caption field. Can I just change it from this.rawValue to this.caption?
Also, I found out that this code:
xfa.form.assessment.Questions.Questionset.Questiondetail.FIBdetail._blanks.count=assessment.Questions.Questionset.Questiondetail.FIBdetail.totalblanks.rawValue
only works for the first instance of the subform _Questiondetail. There are likely to be multiple instances. How do I make it work for subsequent instances?
Views
Replies
Total Likes
No, unfortunately there's no such thing as "this.caption" – that'd be too easy!
I think if you add it to where you've got cnt + ":"; it should work.
xfa.resolveNode("assessment.Questions.Questionset.Questiondetail.FIBdetail.blanks.blanks.caption.value.#text").value = this.parent.index+1 + ":";
Not sure what you're trying to do there. Are you trying to count the instances? Not sure how to do that maybe someone else here knows.
I want the specific number of the subform xfa.form.assessment.Questions.Questionset.Questiondetail.FIBdetail._blanks to appear based on what the user enters into assessment.Questions.Questionset.Questiondetail.FIBdetail.totalblanks.rawValue.
But there are going to be multiple instances of the subform assessment.Questions.Questionset.Questiondetail
Right now the code only works in the first instance.
Views
Replies
Total Likes
I figured this out so I wanted to post my form in case anyone is having the same problem.
Here is the code I used on the click event of a button to create the specified number of subform instances.
xfa.resolveNode("xfa.form.assessment.Questions.Questiondetail[" + (xfa.form.assessment.Questions._Questiondetail.count - 1) + "]").FIBdetail._blanks.count=xfa.resolveNode("xfa.form.assessment.Questions.Questiondetail[" + (xfa.form.assessment.Questions._Questiondetail.count - 1) + "]").FIBdetail.totalblanks.rawValue
Views
Replies
Total Likes