Expand my Community achievements bar.

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

Make checkboxes act like radio buttons

Avatar

Former Community Member
Can anyone help me out with a script to make check boxes act like radio buttons? I'm new to Javascript and would appreciate any help I can get.

Thank you in advance.
4 Replies

Avatar

Level 5
Use the following scenario.... in 'click' or 'exit' event of the each check box.<br /><br />if (this.rawValue == 1) { //this stands for current checkbox<br /> form1.<subformname>.<checkbox1name>.rawValue = 0 // clear checkbox<br /> form1.<subformname>.<checkbox2name>.rawValue = 0 // clear checkbox<br />}<br /><br />Good Luck,<br />SekharN

Avatar

Former Community Member
David_J_Allen@adobeforums.com wrote:

> Can anyone help me out with a script to make check boxes act like radio buttons? I'm new to Javascript and would appreciate any help I can get.

> Thank you in advance.



If you are wanting to do this just for appearance purposes, then you can create a radio button group

and change it's appearance to a solid or sunken square on the field tab. This requires no

Javascript code.

--

Justin Klei

Cardinal Solutions Group

www.cardinalsolutions.com

Avatar

Former Community Member
Thanks Sekhar for the code sample, and thank you Justin for the input. My issue (not sure if this is a bug or not) is that the two buttons I need to link are separated on the page. When I tried to do them as a radio button group, I was unable to control the tabbing order. For whatever reason, I couldn't select the radio button group.

Avatar

Former Community Member
Another solution I have been using is to make sure the check boxes have the same name such as "Checkbox1[0]", "Checkbox1[1]" etc. Then I go to Object > Binding > Default Binding(Open, Save, Submit): and select Global. Then make sure the On Value: is different for each check box.



This gives you check boxes that act like radio buttons except that you are not stuck with something being checked that can't be unchecked unless you reset the form.