How do I hide or disable answer options after a certain time?

More
4 months 2 weeks ago #169444 by Danke
Danke created the topic: How do I hide or disable answer options after a certain time?
Hello Limesurvey-Team,


I want to hide (or disable) radio buttons 10 seconds after the question is loaded.

I used the following skript in a former study (it worked fine; now I am using Version 2.71.1+170927 ):


</script><script type = "text/javascript" charset = "utf-8">

$(document).ready(function() {

setTimeout(function() {

$('#answer828677X2577X12206SQ003').attr("hidden", true);

}, 11000);

});


</script>


It seems that the "hidden"-command isn't working any more. The problem with the "disabled"-command (which is working) is that the answers aren't stored.

Does anyone have an idea what I could try? That would be great! Thank you very much in advance.

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #169596 by Danke
Danke replied the topic: How do I hide or disable answer options after a certain time?
Leeeeemoooons? Aaaaaare youuuuuuu theeeere?

I am grateful for every hint!!

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #169629 by tpartner
tpartner replied the topic: How do I hide or disable answer options after a certain time?
This is a little more complicated than it seems. What happens if someone has already selected that radio?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #169638 by Danke
Danke replied the topic: How do I hide or disable answer options after a certain time?
Thank you, for your reply tpartner!

If I use the "disabled"-command - the command works: the buttons are disabled after a time criterion, and it looks as if the answers would be "locked" (Picture 1) - but they are not stored (there are no entries in the data file). I actually had this problem before in an older limesurvey-version - and then used the "hidden"-command, which isn't working anymore (the radios are not hidden)...
Attachments:

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #169639 by tpartner
tpartner replied the topic: How do I hide or disable answer options after a certain time?
You haven't answered my question. What do you want to do if a radio has already been selected?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #169641 by Danke
Danke replied the topic: How do I hide or disable answer options after a certain time?
Hmm... I am not quite sure if I understand your question.

I want the question to work like a "classic" multiple selection question - with a time criterion (no changes should be possible after 10 s). So, If a radio has been selected - this should be stored as an answer (or one of the multiple answers).

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #169708 by tpartner
tpartner replied the topic: How do I hide or disable answer options after a certain time?
I'm confused. You say "multiple selection question" but radios are for single-choice questions.

Can you attach a small sample survey containing only the pertinent question(s)?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #169715 by Danke
Danke replied the topic: How do I hide or disable answer options after a certain time?
Yes - sorry! It is a "multiple selection question"... Thank you very much for your help!
Attachments:

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #169717 by tpartner
tpartner replied the topic: How do I hide or disable answer options after a certain time?
Okay, I think the solution is simply to re-enable the check-boxes when the "Next" button is clicked.

<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		setTimeout(function() {
			$('#question{QID} input:checkbox').prop('disabled', true);
		}, 11000);
 
		$('#movenextbtn, #moveprevbtn, #movesubmitbtn').on('click', function(e) {
			$('#question{QID} input:checkbox').prop('disabled', false);
		});
	});
</script>

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!