Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Answering hidden question (different page) via Javascript (or something else)

  • Theo_80
  • Theo_80's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 4 months ago #101835 by Theo_80
Dear all,
after hours of searching the web and the forum, I'm begging for your support.
First of all, I'm using LS 1.90+
I have a question Q1 with a set of radio boxes which are cascaded to look like a tree.

* Option 1
** Option 1_1
** Option 1_2
*** Option 1_2_1
* Option 2
...
I managed to get this done via java script and it works rather nice.
Now I do not only need to answer the question but also to store their parent values.
e.g. If the user selects Option 1_2_1, I also need to store Level 1 = Option 1 and Level 2 = Option 1_2
My thoughts were to solve this via three additional text questions (Q2,Q3,Q4) which are hidden but store the values of each level.
If they wouldn't be hidden, I have a solution. Go to page with Q2; parse the results from Q1, determine the level 1 text and store it in the text field.

But as they are hidden, they are not called and so JS is not working.
A nice solution would be to be able to add a hidden field via JS with the name/id of Q2,Q3,Q4 and submit it when answering Q1. Unfortunately this didn't work for me so far.

Now I hope you guys have a solution for this issue.

Any help is appreciated!
Many thanks in advance, Theo
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 4 months ago #101846 by tpartner
When using JavaScript you cannot use the advanced question setting to hide questions. You need to hide them with JavaScript or CSS.

The advanced question setting prevents the question from being rendered so JS has nothing to manipulate.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Theo_80
  • Theo_80's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 4 months ago #101848 by Theo_80
Thanks for confirming my assumption. Is there any better solution apart from post-processing the answers after the survey has finished?

Another thought was adding a hidden field with the other question code and so answer more questions by submitting this one question/page, but I didn't find a valid solution.

My second solution would be to include the hidden questions and after the survey campaign has stopped - fill the fields based on the answers.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose