Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

Automatically fill check boxes upon radioclick

Avatar

Level 1

Hi,

I have a form created with a bunch of checkboxes. To make certian check box selections easy and automatic I have created 4 radio buttons. If the first is selected I want to have 4 checkboxes checked; if the second is selected I want to have the same four checkboxes checked plus 4 more; if the third is checked I want to have 3 different checkboxes checked; and if the fourth is selected I want to have other checkboxes checked. The entire form has about 91 checkboxes. I have tried using the following code at the end of the radio button set. But it is not working.

<event name="event_click" activity="click">

    <script contentType="application/x-javascript">

if(this.rawValue == 1)then

     IntroLetter.rawValue = 1;

     Brochure.rawValue = 1;

     Web-POC.rawValue = 1;

     PHMagnet.rawValue = 1;

else

     IntroLetter.rawValue = 0; 

     Brochure.rawValue = 0;

     Web-POC.rawValue = 0;

     PHMagnet.rawValue = 0;

endif

</script>

               </event>

Can someone please tell me why this isn't working? Is the script contentType wrong? Do I have to list all available checkboxes and make their value 0?

Thanks!

1 Reply

Avatar

Level 10

Hi,

The JavaScript syntax for an if/else statement uses curly brackets:

if (this.rawValue == 1) {

     // then your script

}

else {

     // else do something else

}

Also I would access/input/edit script in the Script Editor (5):

LC Designer Workspace.png

Niall