Welcome, Guest
Username: Password: Remember me

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

Answering hidden question (different page) via Javascript (or something else) 9 months 5 days ago #101835

  • Theo_80
  • Theo_80's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
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 administrator has disabled public write access.

Answering hidden question (different page) via Javascript (or something else) 9 months 5 days ago #101846

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4125
  • Thank you received: 761
  • Karma: 347
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Answering hidden question (different page) via Javascript (or something else) 9 months 5 days ago #101848

  • Theo_80
  • Theo_80's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
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 administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.104 seconds
Donation Image