Welcome to the LimeSurvey Community Forum

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

Show hidden question when button is pressed

  • baszek
  • baszek's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 2 months ago #103266 by baszek
Is it possible to show/reavel previously hidden question with button press.
I know that I can make button with java script and found the way to hide question -> with option in advanced tab ->"always hide this question" set to yes.
I dont know how to show/reveal now that question in button action with javascript.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 2 months ago #103282 by tpartner
Replied by tpartner on topic Show hidden question when button is pressed
You cannot hide the question with the advanced setting - this prevents the question from being rendered in the document so it can never be shown. You will need to initially hide the question with CSS or JavaScript.

.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • baszek
  • baszek's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 2 months ago - 10 years 2 months ago #103284 by baszek
Replied by baszek on topic Show hidden question when button is pressed

tpartner wrote: You cannot hide the question with the advanced setting - this prevents the question from being rendered in the document so it can never be shown. You will need to initially hide the question with CSS or JavaScript.
.

I was trying with that code, which I found at this forum:
Code:
$('#questionQQ').hide();
where QQ is my question id, but it does not work.
Last edit: 10 years 2 months ago by baszek.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 2 months ago #103288 by tpartner
Replied by tpartner on topic Show hidden question when button is pressed
This will work if you use the correct ID:


If your script is placed in the source of the hidden question, you can use the {QID} placeholder:
Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() {
    $('#question{QID}').hide();
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • baszek
  • baszek's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 2 months ago #103289 by baszek
Replied by baszek on topic Show hidden question when button is pressed
Thx - its working, but is it possible now to reveal/show that hidden question from code of other question (which is in the same group)?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 2 months ago #103291 by tpartner
Replied by tpartner on topic Show hidden question when button is pressed
Sure but the code would vary a little depending on question types and positions. Can you attach a small survey with that group and indicate where you want the button and which question is to be hidden?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 2 months ago #103292 by tpartner
Replied by tpartner on topic Show hidden question when button is pressed
Oh, and what version of LS are you using?

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