Hello. I'm trying to use a yes/no radio button group to add and delete instances of a subform. I can get the yes button to add an instance without any problem, but when I try to make the no button delete the instance, it fails. Below is the script I'm trying to use. I'm putting it in the "Change" section
if (this.rawValue=='1')
_SubformName.addInstance(1)
xfa.form.recalculate
if (this.rawValue=='2')
_SubformName.removeInstance(1)
xfa.form.recalculate(1)
I have everything set to flowed and am saving as a dynamic file, so that isn't the problem. Any help would be appreciated.
Solved! Go to Solution.
Views
Replies
Total Likes
Views
Replies
Total Likes
The removeInstance method requires that you pass an instance to remove. In your case it would/should be removing the 2nd instance. Are you getting any errors in the javascript console (hit Ctrl-J).
Paul
Views
Replies
Total Likes
"The removeInstance method requires that you pass an instance to remove. In your case it would/should be removing the 2nd instance. Are you getting any errors in the javascript console (hit Ctrl-J)."
I hit Ctrl-J while in the JavaScript console and nothing came up. I don't think I was the most clear in my question. If someone clicks "yes" they get the subform to fill out. Great. However, if they made a mistake and didn't mean to click "yes", they should be able to click "no" and get rid of the subform. Is this making sense? Also, if I click yes-no-yes, it adds the subform twice, which is not what I want it to do.
Views
Replies
Total Likes
Post your form and I will have a look.
Paul
Views
Replies
Total Likes
Here it is. I'm e-mailing it to you too, in case this gets queued.
Views
Replies
Total Likes
Its queued ...so send it to livecycle8@gmail.com
Paul
Views
Replies
Total Likes
Thanks for your e-mail-it made everything work right! I'm attaching your corrected version so others can avoid this problem.
Views
Replies
Total Likes