Welcome to the LimeSurvey Community Forum

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

script to hide an entire question

More
8 years 3 months ago #128747 by jcruz
script to hide an entire question was created by jcruz
I'm playing around of the things scripting can do to manipulate the behavior of the survey. And I was wondering how to hide a question (including the subquestions and everything) using a script. I know this thing can be done in a snap when initializing the question. But how to do this with a script?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 3 months ago #128755 by DenisChenu
Replied by DenisChenu on topic script to hide an entire question
Hi,

In question text HTML source
Code:
<script>
$(function() {
  $("#question{QID}").hide();
});
</script>

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
8 years 3 months ago #128799 by jcruz
Replied by jcruz on topic script to hide an entire question
Hi Denis,

Thanks for your reply! I've actually thought of this exact script. But it's not working. I actually came up with the scripts that hide subquestions but never the entire question container. Having said that, I am sure that I have enabled Javascript. It's just that I can't select the right element in my scripts. Is "#questionSSSSXGGXQQ" really the right id? I'm not quite sure about my version of LS but administrator said last update was early this year I think.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 3 months ago #128800 by holch
Replied by holch on topic script to hide an entire question
You should see the version of LS in the footer of the administration pages.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
8 years 3 months ago #128801 by jcruz
Replied by jcruz on topic script to hide an entire question
Thanks everyone! I misunderstood {QID} being the whole SGQA indentifier. When I only used question id alone, it worked.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 3 months ago #128804 by DenisChenu
Replied by DenisChenu on topic script to hide an entire question

jcruz wrote: !..... Is "#questionSSSSXGGXQQ" really the right id?....

If you read : i put #question{QID} not anything else.

Please : READ THE MANUAL :
- manual.limesurvey.org/Expression_Manager#Access_to_Variables
- manual.limesurvey.org/Workarounds:_Manip...ime_using_Javascript

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: jcruz
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 3 months ago #128806 by tpartner
Replied by tpartner on topic script to hide an entire question
I think Denis' point is that you don't need to replace "{QID}" with anything - LimeSurvey will automatically insert the ID.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose