Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Search Form for Answers

Avatar

Former Community Member
I have a form that the user completes online and I want to make some adjustments which require a search. For example, Question 1 has 5 subquestions and 1 explanation text box. Depending on the answers (Yes, No , NA) to each subquestion will govern wether or not an explanation is required. If the explanation is required then I want the explanation box to change colors, indicating the user needs to explain. I can make this work by using IF answer != 1 OR =! 2 ... for each subquestion and place that script in the ENTER of the explanation box however if the user goes back and changes an answer then this doesn't work.



EX. User answers all subquestion YES and explanation box does not change colors then the user decides to go back and change an answer to NO the explanation box never changes.



Each DROPDOWN field has a unique name so how can I search all of those fields each time. Likewise I have many questions with this scenario so do I have to code this for each question and all it's sub-parts?
3 Replies

Avatar

Former Community Member
Change your code over to the Exit event (the value that the user has chosen will be set at that time). Ye syou will have check each of the unique fields.

Avatar

Former Community Member
I tried it pretty much on every event trigger but none worked correctly. Here's what I have:

(question 1 has subquestion 1.a,1.b,1.c,1.d,1.e)

A DropDownBox is answered Y/N/NA for each of the 5 subquestions.

There is one explanation textbox for the entire question.

Desired results: The explanation turns color if the user answers any subquestion N/NA. If the user changes the answer the same event should occur.



My approach has been to create a script on each of the five drop-down box to change the color of the explanation box at the time the user makes the selection ie. if(dropdown1.rawValue==1){explanationbox.color....."255,255,255"} if(dropdown1.rawValue==2){explanationbox.color......"255,200,200"} if(dropdown1.rawValue==3){explanationbox.color......"255,200,200"}. But of course the last selection is always going to be the one that governs the color of the explanation box. I chose this approach to make the explanation box change as soon as the user answered. So then I needed to put a script in the explanation box that would search the answers of all the dropdown boxes and to be "255,200,200" if any answer was NO/NA otherwise stay white.



Here's what I put on exit in the explanation box:

if (form.subform1.DDBa.rawValue =! 2 || form.subform1.DDBb.rawValue =! 3){form.subform1.explanbox.border.fill.color.value="255,255,255";}

else {form.subform1.explanbox.border.fill.color.value="255,200,200";}

//And repeat this "If" statement 5 times for each drop-down box.



Hope this clarifies what my goal is here. I've spent many hours on this one and so far nothing has worked 100%. Thanks!

Avatar

Former Community Member
I think you woudl be better off setting the explnation boxes on the exit event of the dropdown. You can test the value of the drodown the act accordingly ...based on the answer.