Automatically proceed to next question after selecting answer

More
3 weeks 6 days ago #171522 by Joffm
Joffm replied the topic: Automatically proceed to next question after selecting answer
Hi, siam,

it is a Javascript snippet.

So you should put it into an Javascript file, here I should say, the "custom.js" of your template is the right place.

Best regards
Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Siem

Please Log in or Create an account to join the conversation.

More
3 weeks 6 days ago #171523 by Siem
Siem replied the topic: Automatically proceed to next question after selecting answer
Thanks Joff, I put it in the Javascript file, but then I get this error:

Error: Syntax error, unrecognized expression: #question{QID} input[type="radio"]

I tried it with and without the <script> tags:
$(document).ready(function(){ 
	$('#question{QID} input[type="radio"]').on('click', function() {
		$('#ls-button-submit').trigger('click');
	});
});

Please Log in or Create an account to join the conversation.

More
3 weeks 6 days ago #171524 by Joffm
Joffm replied the topic: Automatically proceed to next question after selecting answer
Hi,

I put it into the question text (source code mode) and it works.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Siem

Please Log in or Create an account to join the conversation.

More
3 weeks 6 days ago - 3 weeks 6 days ago #171526 by Siem
Siem replied the topic: Automatically proceed to next question after selecting answer

Joffm wrote: Hi,

I put it into the question text (source code mode) and it works.

Joffm


You are right, that was the trick many thanks! :)

I would like to add this code to my theme so it is automatically added to the questions, would this be possible?
It would save a lot of time, since there are multiple tests that need it.
Last Edit: 3 weeks 6 days ago by Siem.

Please Log in or Create an account to join the conversation.

More
3 weeks 5 days ago #171538 by tpartner
tpartner replied the topic: Automatically proceed to next question after selecting answer
If want it to act on EVERY list-radio question in every survey using that template, add this to your theme custom.js file:

$(document).on('ready pjax:scriptcomplete',function(){ 
	$('.list-radio input[type="radio"]').on('click', function() {
		$('#ls-button-submit').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: Siem

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!