Welcome to the LimeSurvey Community Forum

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

Can I hide buttons when using array question type?

  • LSWipo
  • LSWipo's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 4 months ago #225106 by LSWipo
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey 3.0
Own server or LimeSurvey hosting:
Survey theme/template: test_theme
==================
Hello!

I want to hide the buttons for Job A and Job B for 5 seconds to be sure that respondents will not speed through the survey. It is a mandatory question, so respondents cannot continue the survey unless they choose one of the options. If they click "Weiter", the question gives a warning. I could not find the code for hiding the buttons. Can I hide those buttons for Job A and Job B for 5 seconds? 



Thank you in advance!  



 

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #225108 by tpartner
You should also disable the radios in case someone tabs through the survey.

This script in the question source:

Code:
<script type="text/javascript" data-author="Tony Partner">  
  $(document).on('ready pjax:scriptcomplete',function() {
 
    var delay = 5; // Delay time in seconds
 
    $('#question{QID} .answer-item :radio').prop('disabled', true).hide();
    $('#question{QID} .answer-item label').hide();
 
    setTimeout(function() {
      $('#question{QID} .answer-item :radio').prop('disabled', false).show();
      $('#question{QID} .answer-item label').show();
    }, delay*1000);
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: LSWipo

Please Log in to join the conversation.

  • LSWipo
  • LSWipo's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 4 months ago #225323 by LSWipo
Thank you very much for your reply. I implemented it and it worked but when the page is being loaded, the buttons appear for a split second and then become hidden. Do you have any suggestions on how can I solve this? For example, is there a way to hide the whole page for a second without appearing at the beginning for a second? Or can I create a css class to hide the buttons, then maybe the buttons will not appear at the beginning for a split second?

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #225344 by tpartner
Try this:

1) Assign a CSS class "hidden" to the question.

2) Use this script:

Code:
<script type="text/javascript" data-author="Tony Partner">  
  $(document).on('ready pjax:scriptcomplete',function() {
 
    var delay = 5; // Delay time in seconds
 
    $('#question{QID} .answer-item :radio').prop('disabled', true).hide();
    $('#question{QID} .answer-item label').hide();
 
    $('#question{QID}').removeClass('hidden');
 
    setTimeout(function() {
      $('#question{QID} .answer-item :radio').prop('disabled', false).show();
      $('#question{QID} .answer-item label').show();
    }, delay*1000);
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: LSWipo

Please Log in to join the conversation.

  • LSWipo
  • LSWipo's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 3 months ago #225687 by LSWipo
Thanks a lot!

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose