Automatically proceed to next question after selecting answer

More
7 months 3 weeks ago #149263 by Siem
Siem created the topic: Automatically proceed to next question after selecting answer
I have a survey with a list with radio-buttons and I would like the user to proceed to next question after selecting answer.

I have found some javascript solutions on this forum such as this one:
<script type="text/javascript" charset="utf-8">	
	$(document).ready(function(){
 
		$('#question{QID} input.radio').click(function() {
			checkconditions($(this).attr('value'), $(this).attr('name'), $(this).attr('type'))
			$('#movenextbtn, #movesubmitbtn').trigger('click');
		});
	});
</script>

However I get this error when I implement (adding the code to "question.pstpl") it:
One or more mandatory questions have not been answered . Please answer this first to proceed !

I run the default template on version 2.63.0+170304

What can I do to make this work?

Please Log in to join the conversation.

More
7 months 3 weeks ago #149265 by tpartner
tpartner replied the topic: Automatically proceed to next question after selecting answer
I just tested and it works fine for me with a single list-radio question on a page. Do you have other mandatory questions on that page?

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
7 months 3 weeks ago #149267 by tpartner
tpartner replied the topic: Automatically proceed to next question after selecting answer
Oh, wait, there's a conflict when clicking on the .label-clickable elements. Try this:

<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
 
		$('#question{QID} input.radio').click(function() {
			checkconditions($(this).attr('value'), $(this).attr('name'), $(this).attr('type'));
			$('#movenextbtn, #movesubmitbtn').trigger('click');
		});
 
		$('#question{QID} .label-clickable').unbind();
		$('#question{QID} .label-clickable').click(function() {
			$('#question{QID} input.radio').unbind();
			var input = $(this).parent().find('input.radio');
			$(input).trigger('click');
			checkconditions($(input).attr('value'), $(input).attr('name'), $(input).attr('type'));
			$('#movenextbtn, #movesubmitbtn').trigger('click');
		});
	});	
</script>

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
7 months 3 weeks ago #149291 by Siem
Siem replied the topic: Automatically proceed to next question after selecting answer
Many thanks, this solution works perfectly!

Please Log in to join the conversation.

More
1 month 2 weeks ago #158319 by hafees89
hafees89 replied the topic: Automatically proceed to next question after selecting answer
How if I wanna do for 1 question only? This 1 will automatically proceed to next question for every question right. How if 1 question only I wanna do? Mind to help? Thank you.

Please Log in to join the conversation.

More
1 month 2 weeks ago #158325 by DenisChenu
DenisChenu replied the topic: Automatically proceed to next question after selecting answer
@tpartner : adding $(input).trigger('click'); trigger ('#question{QID} input.radio').click(function() , then it must work witout the 2 lines after ? No ?

/me must review framagit.org/SondagePro-LimeSurvey-plugi...assets/autosubmit.js

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
1 month 2 weeks ago - 1 month 2 weeks ago #158327 by hafees89
hafees89 replied the topic: Automatically proceed to next question after selecting answer
Let say I have 5 question all using radio button. But for the 1st question only I wanna use automatic next. It is possible? Kindly advice me on this. Thank you sir.

I'll review ur code sir.. Thank you again..
Last Edit: 1 month 2 weeks ago by hafees89.

Please Log in to join the conversation.

More
1 month 2 weeks ago #158347 by tpartner
tpartner replied the topic: Automatically proceed to next question after selecting answer
@DenisChenu, sure, maybe - that was just a quick fix.

@hafees89, are all radios on the same page?

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
1 month 2 weeks ago #158353 by marektondryk
marektondryk replied the topic: Automatically proceed to next question after selecting answer
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
 
		$('#question{QID} input.radio').click(function() {
			checkconditions($(this).attr('value'), $(this).attr('name'), $(this).attr('type'));
			$('#movenextbtn, #movesubmitbtn').trigger('click');
		});
 
		$('#question{QID} .label-clickable').unbind();
		$('#question{QID} .label-clickable').click(function() {
			$('#question{QID} input.radio').unbind();
			var input = $(this).parent().find('input.radio');
			$(input).trigger('click');
			checkconditions($(input).attr('value'), $(input).attr('name'), $(input).attr('type'));
			$('#movenextbtn, #movesubmitbtn').trigger('click');
		});
	});	
</script>

Where should I put this code?

Please Log in to join the conversation.

More
1 month 2 weeks ago #158357 by tpartner
tpartner replied the topic: Automatically proceed to next question after selecting answer

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
1 month 2 weeks ago #158374 by marektondryk
marektondryk replied the topic: Automatically proceed to next question after selecting answer
Thanks Tony! :)
But how can I hide button NEXT on question pages?

Please Log in to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #158376 by hafees89
hafees89 replied the topic: Automatically proceed to next question after selecting answer
Yes, all radios on the same page.. Only wanna change for the 1st question using auto next..
Attachments:
Last Edit: 1 month 2 weeks ago by hafees89.

Please Log in to join the conversation.

More
1 month 2 weeks ago #158379 by marektondryk
marektondryk replied the topic: Automatically proceed to next question after selecting answer
On the start page I need button NEXT on the question pages I don't want button NEXT. Each question is on the seperate page. I can do button NEXT on all pages or none... but how to do visible button NEXT only on the start page?

Please Log in to join the conversation.

More
1 month 2 weeks ago #158382 by Joffm
Joffm replied the topic: Automatically proceed to next question after selecting answer
Hi, hafees,
you say all question are oft the same type.
So why do you want to confuse your respondents?
They realize an autoproceed in the first question, and may wait for it in the second.
Just something to consider.
Joffm

Please Log in to join the conversation.

More
1 month 2 weeks ago #158385 by hafees89
hafees89 replied the topic: Automatically proceed to next question after selecting answer
This might be good too.. But I assume the code given by @tpartner is enough for now.

Thank you.

Regards,
Hafees.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now