Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Best use of a N/A radio button in conjunction with radio button groups.

Avatar

Level 1

Hello,

I am really new to LiveCycle ES, I'd be too embarassed to tell you how I stumbled into this app.  I am attaching a screen shot of a survey question as designed by our sales team.  Ideally they want me to formulate the question responses in such a way that the N/A response, if selected by the user, disallows other radio buttons from being selected on the same line.  I have built each group to be an exclusionary group so that under each category, only one response is allowed.  The problem is that the N/A option is its own radio group and cannot be deselected.

Does anyone have advice on how to handle an N/A radio button option or can suggest a totally alternative method to handle this.  Its best if you look at the screen shot to see how hokey this truly is.

Thanks,

Julie

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Julie,

You copied my script but did not change the path names to the form variables. My form root was 'form1'. Your form root is 'SupplierSurvey'.

Additionally, two form variable naming conventions rules: do not use dots (.) and do not use hyphens (-).

I renamed 'Page4-SurveyStart' to 'Page4_SurveyStart' and removed the '.1' extension from the radio button exclusion groups in section 1.1. As a result the code works for section 1.1 and you will have to make the applicable changes to the other sections.

Steve

View solution in original post

7 Replies

Avatar

Former Community Member

I commonly use a checkbox that is formatted as a circle. It looks like a radio button but you can toggle it on/off. In the attached form I created an exclusion radio button group called 'bestCustomerComparison'. If you toggle 'notApplicable' on, it resets the exclusion group and makes the group 'readOnly'. If you toggle 'notApplicable' off, you can select a radio button in the group.

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

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

     xfa.host.resetData("form1.page1.subform1.bestCustomerComparison");

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

}

     else {

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

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

          }

}

Steve

Avatar

Level 1

Steve,

You are awesome.  It is exactly what I am looking for.  Now, the hard part comes back to my lack of intelligence when it comes to this app.  How do I incorprate your code into my project.  Do I manipulate the XML source directly?  I think I can do everything through the UI, I am just missing the major part of where it switches to read only and back.

If this above and beyond this forum in terms of how much time you are allowed to commit, then I understand and will work with the excellent guidance you already provided.

Thanks,
Julie

Avatar

Level 1

Getting closer still.  I think I got all of the correct code added, except still a hiccup with the checkbox.  When I activate it to On status, it does not hold.  It immediately goes back to off status.

Avatar

Former Community Member

Julie,

If you can post the form (or send it to me directly through the forum email) I would be happy to take a look.

Steve

Avatar

Level 1

Here it is all its glory...yikes.  I found I had this application ten days ago and so what you are seeing is my first ever use.  I am sure it could be a lot cleaner. 

To help navigate, page 4 subform called One.One is where I attempted to implement the code. 

Avatar

Correct answer by
Former Community Member

Julie,

You copied my script but did not change the path names to the form variables. My form root was 'form1'. Your form root is 'SupplierSurvey'.

Additionally, two form variable naming conventions rules: do not use dots (.) and do not use hyphens (-).

I renamed 'Page4-SurveyStart' to 'Page4_SurveyStart' and removed the '.1' extension from the radio button exclusion groups in section 1.1. As a result the code works for section 1.1 and you will have to make the applicable changes to the other sections.

Steve

Avatar

Level 1

Its a thing of beauty, (at least that section is!).  Thanks for all your help it is most appreciated.

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] ----