Submit answer after click on yes or no

More
3 months 5 days ago - 3 months 5 days ago #156876 by alimeaday
alimeaday created the topic: Submit answer after click on yes or no
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: 3 months 5 days ago by alimeaday.

Please Log in to join the conversation.

More
3 months 4 days ago #156927 by tpartner
tpartner replied the topic: Submit answer after click on yes or no
To apply it to a single question, place this script in the question source:
<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:
$(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

Please Log in to join the conversation.

More
3 months 4 days ago #156931 by alimeaday
alimeaday replied the 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!

Please Log in to join the conversation.

More
3 months 3 days ago #156950 by DenisChenu
DenisChenu replied the 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 service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
3 months 3 days ago #156963 by alimeaday
alimeaday replied the 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?:
$(document).ready(function() {
	$('.yes-no .radio').on('change', function(e) {
		$('#movenextbtn, #movesubmitbtn').delay(300).trigger('click');
	});
});

Please Log in to join the conversation.

More
3 months 2 days ago #156981 by DenisChenu
DenisChenu replied the 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 service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
3 months 2 days ago #156983 by tpartner
tpartner replied the 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.

Please Log in to join the conversation.

More
2 months 4 weeks ago #157036 by DenisChenu
DenisChenu replied the 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 service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now