Welcome to the LimeSurvey Community Forum

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

submitting an answer after click of radio button?

  • collectek
  • collectek's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago #106609 by collectek
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.
The topic has been locked.
More
9 years 11 months ago #106643 by mistertomato
Replied by mistertomato on 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?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 11 months ago #106658 by tpartner
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.
The topic has been locked.
More
9 years 11 months ago #106666 by mistertomato
Replied by mistertomato on 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.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 11 months ago #106670 by tpartner
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:
Code:
$(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:
Code:
<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
The topic has been locked.
More
9 years 11 months ago #106672 by mistertomato
Replied by mistertomato on 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?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 11 months ago #106674 by tpartner
Sorry, that's not possible.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • collectek
  • collectek's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago - 9 years 11 months ago #106675 by collectek
tpartner, this is exactly what I needed - I just needed to understand that association. Most appreciated and thank you.
Last edit: 9 years 11 months ago by collectek. Reason: tpartner answered other question
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose