Can't update a prvious answer with javascript?

More
4 years 7 months ago #89468 by garf
garf created the topic: Can't update a prvious answer with javascript?
Hi everyone,

This little glitch is driving me crazy and I hope someone can point me in the right direction. I've been through everything I can Google in the groups and documents on this topic, but nothing seems to be working.

Simply, I want to update the value of a hidden question from an previous group based on responses from subsequent group questions. The final group has an equation question that runs the code below. I have to do this in script.

It seems so simple...but the values never stay and never update in the database. I've tried using plain numeric input questions and an equation type questions. nada ...

This is probably so obvious that I'm going to be embarrassed... :blush:


 
$(document).ready(function() {
   var T = 100;
   $('input#answerSSXGGXQQ').val(T);   //previous groups question
}
</script>
 

Please Log in to join the conversation.

More
4 years 7 months ago - 4 years 7 months ago #89479 by DenisChenu
DenisChenu replied the topic: Can't update a prvious answer with javascript?
Hello,

With a short text question, try:
$("#question{QID} input.text").val(T);

AND you loose e ); at the end. Please see your javascript console log.

Denis

PS: look at tpartner answer too.

|
|
V


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 .
Last Edit: 4 years 7 months ago by DenisChenu.

Please Log in to join the conversation.

More
4 years 7 months ago #89494 by tpartner
tpartner replied the topic: Can't update a prvious answer with javascript?
You can't use JavaScript to modify the value of a question from a previous group.JavaScript can only modify elements in the current page.

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

Please Log in to join the conversation.

More
4 years 7 months ago #89904 by rupibed
rupibed replied the topic: Aw: Re: Can't update a prvious answer with javascript?
Please let us then how to modify previous questions?

Please Log in to join the conversation.

More
4 years 7 months ago #89905 by DenisChenu
DenisChenu replied the topic: Aw: Re: Can't update a prvious answer with javascript?

rupibed wrote: Please let us then how to modify previous questions?

You can't.

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.

Did you already participate in our customer survey?

Don't miss your chance for great prices.

Please click here to participate:

Start now

Start now!

Just create your account and start using Limesurvey today.

Register now