uncheck Radio button
Copy link to clipboard
Copied
How can I uncheck the radio button?
Copy link to clipboard
Copied
You can't do it manually. You'll need to reset the field using a script or the Clear Form command.
Copy link to clipboard
Copied
This is a limitation of radio buttons. To allow the user to cancel a “real” selection he has made, you can include a radio button that corresponds to a null choice, like “Do not know” or “No answer”. If you want a single button that can be checked or unchecked, use a checkbox.
Copy link to clipboard
Copied
Radio Buttons can't be unchecked. The solution I found from another trend is to use a check box but in order to work like a radio button is to make sure all the boxes has the same name except for the value. Value i used for 6 check boxes are numbers 1-6, all have the same name..Works like a charm...
Hope this works....
Copy link to clipboard
Copied
There are a few options for unchecking radio buttons. Some were already mentioned, such as resetting the radio button group and using check boxes as radio buttons.
Here is an article on how to use a checkbox as a radio button, there's even a sample:
https://acrobatusers.com/tutorials/creating-radio-checkboxes1
But any radio button group can be unchecked with this code;
this.getField("RadioGroup").value = "Off";
In fact, you can create an "uncheck" radio button in the same group by putting this code in the MouseUp script
event.target.value = "Off";
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
I see this response is more than two years old. I hope that you are still listening. 🙂
I presume that in "this.getField("RadioGroup").value = "Off";" refers to the name of the group. Also, I have added this code to the javascript for my "Reset Form" button. Doesn't seem to work. Any thought?
Thanks
Copy link to clipboard
Copied
You're correct, but this would apply as long as the radio button group is mutually exclusive (same field names but different export values; will make the radio buttons behave like checkboxes independent from each other), otherwise the whole group of radio buttons will be checked or unchecked in unison by tjust checking one of them alone.
When you use a group of mutually exclusive radio buttons you'll also may need to emply a zero-based index workflow in your script(s) to work with each radio button individually.
Radio buttons are indexed in the order that they were created.
That said, if you have three of them in the same array, and each radio button has the same field name as "RadioGroup", then the zero based-index workflow would look something like:
this radio button is the first one in the Array --->>> this.getField("RadioGroup").isBoxChecked(0);
this radio button is the second one in the Array --->>>this.getField("RadioGroup").isBoxChecked(1);
this radio button is the third one in the Array --->>>this.getField("RadioGroup").isBoxChecked(2);
As for your reset button you don't really need a code to reset them all since you can use tha built-in Mouse-up event "Reset a Form" and just select from the picklist which radio buttons you want to clear..
But if you still want to use JavaScript you can do the same as a Mouse-up javascript action with:
var f = this.getField("RadioGroup");
this.resetForm([f.name]);

