Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Button to turn checkboxes on

Avatar

Level 1

Can anyone provide me with javascript to turn on a series of checkboxes called "NotApplicable" by clicking a button?

5 Replies

Avatar

Level 10

The check boxes use integer values.

You can change them with;

referenceSyntax.CheckBoxName.value.integer.value = 1; //turn on

referenceSyntax.CheckBoxName.value.integer.value = 0; //turn off

Avatar

Level 1

I applied this formula to the button and it did not work. But I didn't give you all the information.

Can you please be very specific? I know I'm asking a lot, but I know absolutely ZERO about java, so without having the exact java to apply to the button, it's not going to work.

I've put a button on my form called "Not Applicable." Each of the checkboxes I would like turned on are named "NotApplicable." I should also mention, they are all within one column of a table. (Table1.Row2 through Table1.Row19)

Avatar

Level 10

Is the table static or can you add/remove rows on runtime?

For a static table a simple loop will do the job.

But therefore you will have to name every row the same, so die hierachy shows Row[0], Row[1], Row[2] etc..

for ( var i=0; i<=18; i++)

     {

     Table1.Row[i].CheckBox.value.integer.value = 1;

     }

Avatar

Level 1

That didn't work either.

In the script editor what type should it be? Initialize, enter, calculate etc....

I renamed the rows, but still nothing...

Avatar

Level 10

When you use a button, the click:event is what you need ;-)

Be sure the script editor is set to "JavaScript" instead of "FormCalc".

Also, the Reference Syntax to your rows may be different to my example.

To get it simply select one checkbox in a row and select an event in the script editor.

In the first line you can see the fully reference syntax to the checkbox, such as form1.Page.Table.Row[0].CheckBox

Use this one in the loop but replace the [0] with [i].

RefSyntax.jpg