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

Radio Buttons

New Here ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

I wonder if you can even do this.  I have two radio buttons, "yes" and "no". When I went to test the buttons, I now can't uncheck both of them. One of the choices remain checked once once is chosen. I would like the buttons to not have anything in them when they first see this form.

TOPICS
Create PDFs , PDF forms

Views

811

Translate

Translate

Report

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 ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

Hi @Holly3016986304sc ,

 

Radio Buttons work in groups, specifically in your case, I assume that they are mutually exclusive (same PDF widget name for both radio buttons but with a different export value assigned to each one).

 

Usually a third radio button is needed to reset the other two.

 

In which case, you may set that third radio button property as "Visible but doesn't print" (so it not visible if you have to print a hard copy).

 

If using a group  of 3 radio buttons doesn't suit your criteria, you may use a conditional script that can evaluate when  both buttons should be reset to unchecked state.

 

For instance, if a required field in your form is left empty by the user, it can throw an alert for the user to complete all of the required fields before checking a radio button.

 

But in my personal opinion, it is easier to employ a pair of mutually exclusvie Check Boxes... quick and easy.

 

 

Votes

Translate

Translate

Report

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 ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

Another option is to use checkboxes. Radiobuttons and checkboxes are nearly identical, they share all behaviors except one.  When a "checked" checkbox is clicked, it turns off. 

Here is some more infomation. 

https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm

 

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

Votes

Translate

Translate

Report

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 ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

Clear the form before you save it.

Votes

Translate

Translate

Report

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 Beginner ,
Jun 05, 2023 Jun 05, 2023

Copy link to clipboard

Copied

I want to to the same thing! I have a form like this:


Question
O Answer 1
    O Answer 1A
    O Answer 1B
O Answer 2
O Answer 3

 

If the client select Answer 1 and 1A but then wants to switch to Answer 2, the radio button of 1A can't be unselected. 
(Answer 1, 2 and 3 are a radio button group and answer 1A and 1B are a radio button group)

Votes

Translate

Translate

Report

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 ,
Jun 05, 2023 Jun 05, 2023

Copy link to clipboard

Copied

One way to do this is to add code to the MouseUp on #2 and #3 to turn off 1A and 1B, and to make them Read Only so that they can only be selected when #1 is selected.   Code will also need to be added to #1 to turn off Read Only on 1A and 1B.

 

For Example, here is the MouseUP code for Answer  #2. It assumes the name of the 1A 1B group is "Sub1".

this.getField("Sub1").readonly = true;
this.getField("Sub1").value = "Off";

 

Put this same code in the MouseUp for #3

 

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

Votes

Translate

Translate

Report

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 Beginner ,
Jun 05, 2023 Jun 05, 2023

Copy link to clipboard

Copied

Oké thanks, but I'm just a designer. I make my form in Indesign and export it to an interactive pdf.

Where can I put this code? Is it in Indesign, because if it's in Acrobat I have to do it every time I make a new export of my Indesign file. 

Votes

Translate

Translate

Report

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 ,
Jun 05, 2023 Jun 05, 2023

Copy link to clipboard

Copied

LATEST

InDesign is a great design tool, but it is a lousy form tool.  I would suggest separating the visual design from the functional form elements.  You can change the page design without changing the form elements, or any of the other PDF properties. Once form fields are on the PDF and operating, any visual design changes can be added to the PDF by replacing pages. Page replacment does not affect the form fields, it only affects the page background. 

 

  

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

Votes

Translate

Translate

Report

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