Welcome to the LimeSurvey Community Forum

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

Submit answer after click on yes or no

  • alimeaday
  • alimeaday's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 3 months ago - 7 years 3 months ago #156876 by alimeaday
Submit answer after click on yes or no was created by alimeaday
Hello,

Is it possible that on a yes/no question in "Button Group" format you can autosubmit the answer without the user have to click on the "Next" button? So that the users only have to click on yes or no and then it goes to the next question?

I have seen in this forum some js tipps for yes/no Radio lists but they do not work for Button groups.

Thanks.
Last edit: 7 years 3 months ago by alimeaday.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 months ago #156927 by tpartner
Replied by tpartner on topic Submit answer after click on yes or no
To apply it to a single question, place this script in the question source:
Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    $('#question{QID} .radio').on('change', function(e) {
      $('#movenextbtn, #movesubmitbtn').trigger('click');
    });
    });    
</script>

To apply it to all Yes/No questions in your survey, add this to the end of template.js:
Code:
$(document).ready(function() {
  $('.yes-no .radio').on('change', function(e) {
    $('#movenextbtn, #movesubmitbtn').trigger('click');
  });
});

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: alimeaday
The topic has been locked.
  • alimeaday
  • alimeaday's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 3 months ago #156931 by alimeaday
Replied by alimeaday on topic Submit answer after click on yes or no
Thank you very much, that did the trick!
Also thanks that you included the global solution!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
7 years 3 months ago #156950 by DenisChenu
Replied by DenisChenu on topic Submit answer after click on yes or no
For informatio, i add the 300ms delay : because sometimes EM broke submit (value submitted not updated)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • alimeaday
  • alimeaday's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 3 months ago #156963 by alimeaday
Replied by alimeaday on topic Submit answer after click on yes or no
Do you mean that without the delay we might end up with the wrong answer in the database?
Is the 300 ms an educated safe guess or do we need more to be 100% safe?
Would this code line work?:
Code:
$(document).ready(function() {
  $('.yes-no .radio').on('change', function(e) {
    $('#movenextbtn, #movesubmitbtn').delay(300).trigger('click');
  });
});
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
7 years 3 months ago #156981 by DenisChenu
Replied by DenisChenu on topic Submit answer after click on yes or no
I see it in rare condition with a 2.05 version , unsure it's still needed.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 months ago #156983 by tpartner
Replied by tpartner on topic Submit answer after click on yes or no
I have never encountered that problem.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
7 years 3 months ago #157036 by DenisChenu
Replied by DenisChenu on topic Submit answer after click on yes or no

tpartner wrote: I have never encountered that problem.

If i remind i have issue with some control on Array question type with some Expression Manager system in it. Didn't really remind for now.

And since the plugin : expression manager javascript have some optimisation :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose