Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Radio Button Confusion

Avatar

Former Community Member

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
Former Community Member

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

Paul

View solution in original post

6 Replies

Avatar

Former Community Member

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

Former Community Member

"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

Former Community Member

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

Avatar

Correct answer by
Former Community Member

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

Paul

Avatar

Former Community Member

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

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----