Check out the LimeSurvey source code on GitHub!

Show hidden question when button is pressed

More
3 years 1 month 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.

Please Log in to join the conversation.

More
3 years 1 month ago #103282 by tpartner
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.

Please Log in to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #103284 by baszek

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:
$('#questionQQ').hide();
where QQ is my question id, but it does not work.
Last Edit: 3 years 1 month ago by baszek.

Please Log in to join the conversation.

More
3 years 1 month ago #103288 by tpartner
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:
<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.
Attachments:

Please Log in to join the conversation.

More
3 years 1 month ago #103289 by baszek
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)?

Please Log in to join the conversation.

More
3 years 1 month ago #103291 by tpartner
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.

Please Log in to join the conversation.

More
3 years 1 month ago #103292 by tpartner
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.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form