Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

How to check the check box in the form?

Avatar

Level 8

Hello

I have couple of check boxes on my form, like....... my_check_box_monthly....... my_check_box_yearly.

I have 2 scenarios, so based on scenario, i hv to select either of the check box, as below

if scenario_1

check the my_check_box_monthly

else if scenario_2

check the my_check_box_yearly.

endif.

Pls. let me know How to write check the check box (my_check_box_daily) in Java Script?

Thank you

1 Reply

Avatar

Level 2
Level 2

Hi,

You can write the following code:

If (Scenario_1){

checkbox1.rawValue=1;

checkbox2.rawValue=0;}

else if(Scenario_2){

checkbox1.rawValue=0;

checkbox2.rawValue=1;}

And if you have much more checkBoxes then you can put them in different subform_scenario1checkBoxes, subform_scenario2checkBoxes and according to the scenarios pick all the nodes of each subform and change the values.

Hope this helps.