Welcome, Guest
Username: Password: Remember me

TOPIC: Use double value of an answer for slider max?

Use double value of an answer for slider max? 3 years 2 weeks ago #68482

  • gefaber
  • gefaber's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
Hello,

I have been trying a few things now, but I cannot make it work. I changed qanda.php a bit already, so now I can put an INSERTANS as the max for slider.

To get twice as high value as a slider max I thought a workaround would be to prefill another question via Javascript with the answer*2 and then use that second answer for the slider max. Then I could just hide that second question.

However, I cannot manage to prefill an answerfield via Javascript. There is an answer in the workarounds-section of the manual, but it doesn't work. So far the user enters the answer in one group and in the next I have a question where I put the code in the question text. It doesn't even work yet to prefill with the exact same answer. What is wrong with the workaround description?

I'm using the latest stable release of LimeSurvey.

Thank you for your help!
The administrator has disabled public write access.

Re: Use double value of an answer for slider max? 3 years 2 weeks ago #68484

  • gefaber
  • gefaber's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
:woohoo:
solved! took me a few hours to find the problem.

there's a typo in the workarounds:
);
is missing in the end.

I got to fill my second question with the following code now. I hid this question via CSS
#question52 {display: none;}
then.
<script type="text/javascript" charset="utf-8">
 
$(document).ready(function() {
document.getElementById('answer33775X1X52').value=parseInt('{INSERTANS:33775X3X7}')*2;
	});
</script>
The administrator has disabled public write access.

Re: Use double value of an answer for slider max? 3 years 2 weeks ago #68493

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6551
  • Thank you received: 869
  • Karma: 257
Hello,

You can update the wiki if you want and correct the workaround according to your test :).

I make some correction more, can you have a look and test ?

docs.limesurvey.org/Workarounds%3A+Manip...stion_default_value_

Denis
The administrator has disabled public write access.

Re: Use double value of an answer for slider max? 3 years 2 weeks ago #68510

  • gefaber
  • gefaber's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
Merci,

the script is shorter now and works the same way. B)
The administrator has disabled public write access.

Re: Use double value of an answer for slider max? 3 years 2 weeks ago #68594

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5423
  • Thank you received: 307
  • Karma: 252
gefaber wrote:
Merci,

the script is shorter now and works the same way. B)
You're welcome!

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.265 seconds
Donation Image