Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

uncheck Radio button

New Here ,
Mar 21, 2017 Mar 21, 2017

How can I uncheck the radio button?

TOPICS
PDF forms
15.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2017 Mar 22, 2017

You can't do it manually. You'll need to reset the field using a script or the Clear Form command.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2017 Mar 22, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 01, 2018 Feb 01, 2018

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....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 01, 2018 Feb 01, 2018

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";

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 07, 2020 Nov 07, 2020

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

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 07, 2020 Nov 07, 2020
LATEST

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]);

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines