Welcome to the LimeSurvey Community Forum

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

Save the data after processing

  • nguyenthedat
  • nguyenthedat's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 4 months ago #239198 by nguyenthedat
Save the data after processing was created by nguyenthedat
I have a text display, a hidden "Multi short text" question in a group. After I have calculated somthing in the text display, I showed up the result in it but I want to save this result to the responses. I used this code to do this but look like it didn't work. What wrong with my code?
Code:
var a = 18;
var b = 12;
var c = 12;
var d = 6;
$(document).ready(function(){    
  $('#question{QID} textarea').val(a);    
  $('#question{QID} textarea').val(b);    
  $('#question{QID} textarea').val(c);    
  $('#question{QID} textarea').val(d);
});

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 3 months ago #239203 by Joffm
Replied by Joffm on topic Save the data after processing
Hi,
you did not only ignore the initial questions, but also removed them.
Why?

And as answer:
Use a question of type "equation" to do calculations and store results.

Joffm 


 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 3 months ago - 1 year 3 months ago #239207 by tpartner
Replied by tpartner on topic Save the data after processing
If you need to load the question via JavaScript, I see several problems...

As Joffm states, you did not give the LimeSurvey version, hosting, theme information.

You are targeting textarea elements where you probably have text input elements.

You are not targeting specific elements.

You are not firing a change event.

Attach a small sample survey (.lss file) containing only the relevant question.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 1 year 3 months ago by tpartner.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose