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

Acrobat Form: Java script to require a radio button choice when a check box is checked

Community Beginner ,
Mar 05, 2020 Mar 05, 2020

Copy link to clipboard

Copied

I have been asked to make an Acrobat DC form with a feature where if the user checks a certain check box, they would then be required to choose one out of two radio buttons. Is this possble? I don't know much about java script or coding. 

 

Thanks,

Debra

 

 

TOPICS
Acrobat SDK and JavaScript

Views

348

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 ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

It's possible to set a field as required, but that is only validated when the file is submitted.

Is that what you mean?

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 ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

Thank you for your reply. I don't think it answers my question but I'm not sure how else to word it. I do know how to make a choice in the form required, so that is not the problem.

In the form, one section has multiple options that the user can choose, none of which are required. But if the user chooses one particular option, then  I need the user to be required to choose one of two radio buttons following the specific choice.

For example, if the user checks a box named "Restriction" (which is not a required option) I then need to the user to be required to choose one of two radio buttons, named "Ship1" or "Ship2". Does that make sense?

 

Thanks,

 

Debra

 

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 ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

You need to clearly define what you mean by "the user to be required to choose one of two radio buttons".

How is it enforced? What happens if they don't make a choice?

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 ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

I don't know how something like that is enforced in Adobe Forms - that is why I am asking this question. I don't know what I don't know, so it is difficult to explain when I don't have the correct terms to do so.

I imagine there could be different scenarios if the user doesn't choose one of the radio buttons, but I don't know what the capabilites of Acrobat forms are. When I fill out online forms, if I miss adding a piece of information, when I try to submit the form I get redirected to the part of the form I didn't fill out correctly. It is usually outlined in a red box. But this form will be emailed to users for them to fill out and then emailed back.

This is more complicated than I realized, so perhaps I just need to redesign the form and add text that informs the user they must choose one of the radio buttons if they check the "Restriction" box. 

 

Thank you for your help.

 

 

 

 

Thanks,

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 ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

In order for us to be able to help you we need to understand what you want to achieve.

If the PDF is being emailed back via a Submit button in the form itself, then it is possible. Anything else is problematic, although your idea of showing an alert is a good one.

 

Another option is to make a selection in the radio-buttons when the check-box is ticked, and since radio-buttons can't be "un-selected" then that would force a selection, either way. However, I'm not sure if you want to have one of the option selected by default or not.

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 ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

In this case I use to:

- turn the stroke of the radio-buttons to red when the checkbox is clicked,

- turn the stroke of the radio-buttons to transparent (or to the previous color) when a radio-button is clicked.

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 ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

Thank you for your reply. 

I don't think it answers my question but I'm not sure how else to word it. I do know how to make a choice required in the form , so that is not the problem.

In the form, one section has multiple options that the user can choose, none of which are required. But if the user chooses one particular option, then  I need the user to be required to choose one of two radio buttons following the specific choice.

For example, if the user checks a box named "Restriction" (which is not a required option) I then need to the user to be required to choose one of two radio buttons, named "Ship1" or "Ship2". Does that make sense?

What I think you are saying is that when the user checks the box (Restriction) then both radio buttons (Ship1 and Ship2)  turn red. But when a radio button is clicked, the color returns to its original color.  The red color would alert the user to the radio buttons, but does not make them required,  Is that what you are saying?

 

Thanks,

 

Debra

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 ,
Mar 07, 2020 Mar 07, 2020

Copy link to clipboard

Copied

LATEST

Yes

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