Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

2 sets of Radio Buttons in a Form-complications

Avatar

Level 1

Hello everyone,

I have been looking around for code to assist me in building a form. I have developed the form, and just have a couple problems that I can't figure out.

In one question on the form the user can choose from one set of radio buttons and select one of the five options. Then I have a second set of radio buttons, that the user can again only choose one option. My problem is that I only want the user to be able to select from the second set of radio buttons if they selected a certain option in the first set. An example to clear up my problem:

Did you finish the training:

Yes

Half

None

So if the user selected yes from the first set of radio buttons, I want the second set of radio buttons to now be selectable:

The training was:

Up-beat and enjoyable

Snoozer

The conditions that I am using are very different than these but this is just a simple skit. So how do I make the second set of radio buttons unselectable until the user selects a specific radio button from the first set of radio buttons.

Thanks, I really appreciate the help!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

If you have a radio button exclusion group called 'completion' with three items 'Yes','Half', and 'None' and a second radio button exclusion group called 'completion', go to the 'feedback' Value tab and set the type to 'readOnly'.

Add the following script to the 'completion' change event...

// form1.page1.subform1.completion::change - (JavaScript, client)

if (this.rawValue == "Yes") {

  form1.page1.subform1.feedback.access = "";

}

else {

  form1.page1.subform1.feedback.access = "readOnly";

  form1.page1.subform1.feedback.rawValue = "";

}

If the user selects 'Yes', the 'feedback' group is available for selection. If the user does not select 'Yes', 'feedback' is reset and made readOnly.

Steve

View solution in original post

4 Replies

Avatar

Correct answer by
Former Community Member

If you have a radio button exclusion group called 'completion' with three items 'Yes','Half', and 'None' and a second radio button exclusion group called 'completion', go to the 'feedback' Value tab and set the type to 'readOnly'.

Add the following script to the 'completion' change event...

// form1.page1.subform1.completion::change - (JavaScript, client)

if (this.rawValue == "Yes") {

  form1.page1.subform1.feedback.access = "";

}

else {

  form1.page1.subform1.feedback.access = "readOnly";

  form1.page1.subform1.feedback.rawValue = "";

}

If the user selects 'Yes', the 'feedback' group is available for selection. If the user does not select 'Yes', 'feedback' is reset and made readOnly.

Steve

Avatar

Level 1

I am having a hard time placing the script. I uploaded it to a generic file site, http://www.mediafire.com/?rnmy2hm0o5y

Can you point out to me where to put that in. I am not very good with code, because I generally use the friendly user face.

I am working with step four and five. I have disabled the aftercare, monitoring only, relapse prevention, and no qualifier. I only want the user to be able to select them if they select finish. I know that I have some other things that I need to add to this form to fix it up, but this is my first one.

Thanks a ton!

Avatar

Former Community Member

Click on the radio button exclusion group in the Hierarchy and add the script to the change event in the Script Editor window.

p.png

If you would like, send an email to stwalker.adobe@gmail.com and I will forward the form.

Steve

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----