Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Radio Button Confusion

Avatar

Level 4

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.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Its queued ...so send it to livecycle8@gmail.com

Paul

View solution in original post

0 Replies

Avatar

Level 10

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

Avatar

Level 4

"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.

Avatar

Level 10

Post your form and I will have a look.

Paul

Avatar

Level 4

Here it is.  I'm e-mailing it to you too, in case this gets queued.

Avatar

Correct answer by
Level 10

Its queued ...so send it to livecycle8@gmail.com

Paul

Avatar

Level 4

Thanks for your e-mail-it made everything work right!  I'm attaching your corrected version so others can avoid this problem.