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

How can I have a radio button selection grey out a drop menu option.

Community Beginner ,
Nov 11, 2023 Nov 11, 2023

Copy link to clipboard

Copied

I have a form that one of the questions is Male or Female and a Radio button for each choice, after selecting Female I want a drop down menu that asks if Pregnant.  So I have put a drop down next to it with a Yes or No to select.  Obviously if you select male I want the drop down to be grey out or not able to select it.  Thank you in advanced for the help.

TOPICS
Create PDFs

Views

256

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

correct answers 1 Correct answer

Community Expert , Nov 11, 2023 Nov 11, 2023

Let's say your choices in radio buttons are named "Male" and "Female" and your dropdown field is named "Pregnant,
use this as 'Mouse Up' action (Run a JavaScript) of "Male" radio button:
if(event.target.value == "Male")
this.getField("Pregnant").readonly = true;

 

use this as 'Mouse Up' action (Run a JavaScript) of "Female" radio button:
if(event.target.value == "Female")
this.getField("Pregnant").readonly = false;

Votes

Translate

Translate
Community Expert ,
Nov 11, 2023 Nov 11, 2023

Copy link to clipboard

Copied

Let's say your choices in radio buttons are named "Male" and "Female" and your dropdown field is named "Pregnant,
use this as 'Mouse Up' action (Run a JavaScript) of "Male" radio button:
if(event.target.value == "Male")
this.getField("Pregnant").readonly = true;

 

use this as 'Mouse Up' action (Run a JavaScript) of "Female" radio button:
if(event.target.value == "Female")
this.getField("Pregnant").readonly = false;

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 ,
Nov 12, 2023 Nov 12, 2023

Copy link to clipboard

Copied

It might also be a good idea to reset the "Pregnant" field when "Male" is selected, just in case.

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

Copy link to clipboard

Copied

Thank you for your answer, however it gives me an error.  Im not sure if this makes a diference but the Male Femal Radio buttons and Pregnant drop down menu are part of a radio group called "Aplicant Gender".  

 

Screenshot 2023-12-05 at 10.46.39 AM.png

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

Copy link to clipboard

Copied

What is the error you get?

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

Copy link to clipboard

Copied

Actullay I did a mistake it works, however if I select Female and also select yes or no, then l go back and select Male "Yes" or "No" is still displayed.Screenshot 2023-12-05 at 11.52.22 AM.png

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

Copy link to clipboard

Copied

What should be displayed? You said you only have "Yes" and "No" in dropdown, do you have a default value like empty space or something else?

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

Copy link to clipboard

Copied

LATEST

I got it, there is a blank space option and I just realised that the mouse up can have 2 functions and one of them I set up is to reset the form but I de selected all and just maid it to reset "Pregnant", thanks alot!!

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