Welcome to the LimeSurvey Community Forum

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

Selecting answer also submits, using Bootstrap buttons

  • paul.emmines
  • paul.emmines's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 3 months ago #223921 by paul.emmines
Hi

My survey is using the Bootswatch theme, each question uses Bootstrap buttons, either 4 or 5 answer buttons.

I would like the selection of the answer to also submit and move to the next Q (and for the Submit button to be hidden.)

Is this possible?


 

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 months ago #223944 by holch
You will need to use javacript for this. There are quite a few examples of this here in the forum, have a search.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

  • paul.emmines
  • paul.emmines's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #228228 by paul.emmines
I have searched high and low. Lots of js solutions for different Q types, but none specifically for Bootstrap Buttons?

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 11 months ago #228260 by tpartner
LimeSurvey version?

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.

  • paul.emmines
  • paul.emmines's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #228279 by paul.emmines
Version 5.3.13, LS hosted. It's a single choice question, using Bootstrap Buttons. All help much appreciated!

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 11 months ago #228281 by tpartner
This script in the source of a single-choice Bootstrap buttons question will hide the submit button and auto-advance the survey when a button is selected.
 
 
Code:
<script type="text/javascript" data-author="Tony Partner">  
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Hide the submit button
    $('#ls-button-submit').hide();
 
    // Listener on the (hidden) radio inputs 
    $('#question{QID} :radio').on('change', function(e) {
      $('#ls-button-submit').trigger('click');
    });
  });
</script>

Sample survey attached: 

File Attachment:

File Name: limesurvey...8(1).lss
File Size:34 KB

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.

Lime-years ahead

Online-surveys for every purse and purpose