Welcome to the LimeSurvey Community Forum

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

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

More
5 years 10 months ago #169444 by Danke
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.
The topic has been locked.
More
5 years 10 months ago #169596 by Danke
Leeeeemoooons? Aaaaaare youuuuuuu theeeere?

I am grateful for every hint!!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169629 by tpartner
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.
The topic has been locked.
More
5 years 10 months ago #169638 by Danke
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:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169639 by tpartner
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.
The topic has been locked.
More
5 years 10 months ago #169641 by Danke
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).
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169708 by tpartner
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.
The topic has been locked.
More
5 years 10 months ago #169715 by Danke
Yes - sorry! It is a "multiple selection question"... Thank you very much for your help!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169717 by tpartner
Okay, I think the solution is simply to re-enable the check-boxes when the "Next" button is clicked.

Code:
<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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose