Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Hidden questions

Hidden questions 3 years 8 months ago #57689

  • thaJack
  • thaJack's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
If I specify a question to always be hidden, then set conditional logic on it, would any JavaScript in the hidden question itself still be processed?

For example, I want to hide question 2. But Question 2 is still based on the user answering "YES" to question 1.

So, if the user answers "YES" to question 1, then question 2 has some JavaScript that would populate the answer to question 2 with "some value."

Is that possible, or would a hidden question not even get to run its JavaScript?
The administrator has disabled public write access.

Re: Hidden questions 3 years 8 months ago #57691

  • thaJack
  • thaJack's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
I found the answer to my own question here. However, I would like to note that I would love to see this feature implemented:

ideas.limesurvey.org/ideatorrent/idea/262/
The administrator has disabled public write access.

Re: Hidden questions 3 years 8 months ago #57727

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4364
  • Thank you received: 827
  • Karma: 381
In the meantime you can use CSS to hide the question. Add the following to the end of template.css, replacing "QQ" with your question ID.
#questionQQ {
	display: none;
}
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.

Re: Hidden questions 3 years 8 months ago #57729

  • thaJack
  • thaJack's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
Wouldn't I end up with a blank page? I'm doing question by question.

What is the purpose of hidden questions if you can't do anything with them?
The administrator has disabled public write access.

Re: Hidden questions 3 years 8 months ago #57732

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4364
  • Thank you received: 827
  • Karma: 381
Wouldn't I end up with a blank page? I'm doing question by question.
Yeah, unfortunately that's true if you go question by question. In that case you would also need to add a little JavaScript to auto-advance the page.
What is the purpose of hidden questions if you can't do anything with them?
I'm not sure what the thinking was behind this but I believe it will be changed in future release.
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.
The following user(s) said Thank You: thaJack

Re: Hidden questions 3 years 8 months ago #57734

  • thaJack
  • thaJack's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
Thanks, Tony. By the way, are you capable and interested in doing this? (see below)

www.limesurvey.org/forum/development/576...opment?lang=en#57667
The administrator has disabled public write access.

Re: Hidden questions 3 years 8 months ago #57737

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4364
  • Thank you received: 827
  • Karma: 381
Sorry, that would require PHP (server-side) coding and I'm more a JavaScript (client-side) guy.
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.

Re: Hidden questions 3 years 8 months ago #57740

  • thaJack
  • thaJack's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
No worries. If I were to use the code you were talking about to hide the question, I could use JavaScript to pre-fill it with a value if it ended up being displayed based on conditional logic, right?

For example, we'll call this question 10. I have a bunch of conditions set on question 10 so that it will only come up if any of those condition scenarios are met.

When it comes up, I can use JavaScript to hide the short text field and then populate the short text field with, for example "YES".

I could then use JavaScript to advance the page once that is done. Would advancing the page work the same way even if it was the last question? i.e. "Finish" instead of "Next"?
The administrator has disabled public write access.

Re: Hidden questions 3 years 8 months ago #57741

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4364
  • Thank you received: 827
  • Karma: 381
That would all work except I wouldn't do it on the last page. In that case the auto-advance would submit the survey which I'm not sure you want to do automatically.
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.

Re: Hidden questions 3 years 8 months ago #57742

  • thaJack
  • thaJack's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
It would be okay for it to submit. The last page is just using the conditional logic to make some determinations and then populate a field that I want included in the confirmation email.

Essentially the question before the hidden one is the "last question".
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.130 seconds
Donation Image