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

add a child question to a yes no question

New Here ,
Oct 21, 2024 Oct 21, 2024

I need to add a child question for when the User answers yes to a parent question, can this be done?

 

Specific scenario - A User answers yes to the question and is then presented with additional question options.  If the User answers no then they move on to the next question on the form.

TOPICS
Edit and convert PDFs , PDF
300
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 ,
Oct 21, 2024 Oct 21, 2024

You can do it by show/hide child questions fields until yes/no are selected.

What type of fields do you use?

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 ,
Oct 21, 2024 Oct 21, 2024

The parent question is a yes/no question so I was using radio buttons but if I need to change that format, I can.  The parent just has to be Yes / No and if Yes, then they are presented with 3 options they must choose one of.

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 ,
Oct 21, 2024 Oct 21, 2024

Are the options also radio buttons?

What are the names of your fields?

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 ,
Oct 22, 2024 Oct 22, 2024

The parent options are radio buttons as well.  The User can only select Yes or No and it's required.  Field Names are NaturalDisaster-Y and NaturalDisaster-N.  The child options of Yes would be Y-Recovery, Y-Preparation, Y-Response (not in that order)

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 ,
Oct 22, 2024 Oct 22, 2024
LATEST

If those are your field names, then place this as 'Custom calculation script' of any text field:

var f = this.getField("NaturalDisaster-Y").valueAsString;
this.getField("Y-Response").display = (f == "Off")? display.hidden : display.visible;
this.getField("Y-Recovery").display = (f == "Off")? display.hidden : display.visible;
this.getField("Y-Preparation").display = (f == "Off")? display.hidden : display.visible;

Addition:

Why are your radio buttons not part of the same group? I assume user should be able to select only one choice, right? You should name parent group "NaturalDisaster" give one button a 'radio button choice' "Yes" and second button choice "No" (you can set 'radio button choice' under 'Options' tab of radio button properties),

name your child group "NDYes" give them different choice (Response, Recovery, Preparation).

That way, users would be able to select only one choice, and in that case use this script:

var f = this.getField("NaturalDisaster").valueAsString;
this.getField("NDYes").display = (f == "Yes")? display.visible : display.hidden;

 If for some reason you don't need mutually exclusive buttons disregard 'Addition' part.

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