submitting an answer after click of radio button?

More
3 years 6 months ago #106609 by collectek
collectek created the topic: submitting an answer after click of radio button?
Hello,

I would like to have the person taking a survey to only click the answer (radio box list) and for that click to be submitted as their answer without them having to click "submit". How could I go about doing this?

Example: survey asks a yes or no question.... person clicks yes.... answer is submitted as if they clicked the 'submit' button.

Thank you much.

Please Log in to join the conversation.

More
3 years 6 months ago #106643 by mistertomato
mistertomato replied the topic: submitting an answer after click of radio button?
I would like to know this too, I believe this requires som sort of ajax call. Someone must have tried this in LimeSurvey before?

Please Log in to join the conversation.

More
3 years 6 months ago #106658 by tpartner
tpartner replied the topic: submitting an answer after click of radio button?
Do you want this for a single radio question or for all radios in a survey?

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
3 years 6 months ago #106666 by mistertomato
mistertomato replied the topic: submitting an answer after click of radio button?
I dont know about OP (collectek), but in my case it is to be used on all radio buttons in the survey. Actually being able to do this on all fields would be awesome, to make sure that all answers are received even if the user exists prematurely.

Please Log in to join the conversation.

More
3 years 6 months ago #106670 by tpartner
tpartner replied the topic: submitting an answer after click of radio button?
Well, you can't do it for all question types. For example, if you apply it to a mandatory array, the respondent will never be allowed to proceed.

To have all List (radio) questions automatically click the "Next" button, add this to the end of template.js:
$(document).ready(function() {
 
	$('.list-radio input[type="radio"]').click(function(event) {
		$('#movenextbtn, #movesubmitbtn').click();
	});
});

To have a specific List (radio) question automatically click the "Next" button, add this to the question source:
<script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {
 
		$('#question{QID} input[type="radio"]').click(function(event) {
			$('#movenextbtn, #movesubmitbtn').click();
		});
	});
</script>


.

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: collectek

Please Log in to join the conversation.

More
3 years 6 months ago #106672 by mistertomato
mistertomato replied the topic: submitting an answer after click of radio button?
Thanx for the answer. But this is actually just submitting the whole page/form as I understand it.
I only want that specific answer saved (perhaps via some ajax or something), and having the rest of the page/Form available for the user to fill out.

The reason I want this, is that a lot users dont fill out all questions on the page, and never clicks the submit button. But we still want all the data they have filled out, even though they only answered i.e. 2 out of 5 questions on a page.

I hope you understand what I mean?

Please Log in to join the conversation.

More
3 years 6 months ago #106674 by tpartner
tpartner replied the topic: submitting an answer after click of radio button?
Sorry, that's not possible.

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
3 years 6 months ago - 3 years 6 months ago #106675 by collectek
collectek replied the topic: submitting an answer after click of radio button?
tpartner, this is exactly what I needed - I just needed to understand that association. Most appreciated and thank you.
Last Edit: 3 years 6 months ago by collectek. Reason: tpartner answered other question

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now