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

Is it possible to activate/de-activate different parts of a dynamic form by ticking/unticking a checkbox?

Avatar

Former Community Member

I am creating a form that has several sections with only a few sections relevant to any particular client. Essentially, I want to de-activate/make invisible the other sections that are not relevant to the client based on the checkboxes that they tick. Therefore the printed form shows only the sections relevant to the client. I am very new to Adobe Designer so any help with this would be appreciated. Thanks.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi,

1) Add checkbox for every section.

2) Set the ON value as Y and OFF value as N for every checkbox

3) Add script to achieving the following:

     if(chkbox.rawValue == "Y")

     {

          section.presence = "visible";

     }

     else

     {

          section.presence = "hidden";

     }

If you wish, you can send me the form @ kvdvijaykumar@gmail.com

Thanks,

VJ

View solution in original post

3 Replies

Avatar

Correct answer by
Former Community Member

Hi,

1) Add checkbox for every section.

2) Set the ON value as Y and OFF value as N for every checkbox

3) Add script to achieving the following:

     if(chkbox.rawValue == "Y")

     {

          section.presence = "visible";

     }

     else

     {

          section.presence = "hidden";

     }

If you wish, you can send me the form @ kvdvijaykumar@gmail.com

Thanks,

VJ

Avatar

Former Community Member

Thank you so much for your reply! This was really really helpful!

I was also wondering if there is anyway that I can connect two checkboxes to each other so that checking/unchecking one automatically checks/unchecks another at a different location in the form.  I want the client to select/de-select a checkbox earlier in the form that causes a checkbox  in later sub-sections of the form to be selected/deselected based on the earlier selection. The automatic select/de-select would then determine if the sub-section would be visible or hidden.

Thanks again for the help!

Avatar

Former Community Member

Dear Kia111,

It is possible. What you can do is, insert a radio button group and set the appearance as "checkbox". In this case, you radio button group will appear as if two checkboxes are placed. But, the behavior will be the way you wanted. Checking one radio button (checkbox) will uncheck the other and vice-versa.

In this case, you  need to tweak your code based on the binding values set for each radio button in the radio button group. For eg., say if 1 and 2 are the binding values for two radio buttons:

if(chkbox.rawValue == "1")

     {

          section.presence = "visible";

     }

     else

     {

          section.presence = "hidden";

     }

Hope this helps.

Thanks,

VJ

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] ----