Welcome, Guest
Username: Password: Remember me

TOPIC: Just show one question from randomized group, hide the others

Re: Just show one question from randomized group, hide the others 2 years 5 months ago #78922

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4190
  • Thank you received: 787
  • Karma: 359
The firing of checkconditions() was always required for dynamic conditions on a page.

Tom, are you saying that if checkconditions() is not called, the value of an input field that was modified by JavaScript will not be detected when the form submits (the "Next" button is clicked) for use in conditions on subsequent pages?
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Just show one question from randomized group, hide the others 2 years 5 months ago #78924

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
As long as the proper javascript variable has its value set, the value will be submitted when the user clicks "next". In the example below, the user set the $('#answerSGQA") variable, which is the widget that lets the user see the value, but it is the $('#javaSGQA') variable that is typically the one submitted. checkconditions() not only triggers the conditional logic, but also tends to populate the $('#javaSGQA') variable if passed the value from the $('#answerSGQA') value.
The administrator has disabled public write access.

Re: Just show one question from randomized group, hide the others 2 years 5 months ago #78928

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4190
  • Thank you received: 787
  • Karma: 359
Hmm, I don't see any $('#javaSGQA') element for text inputs.

Regardless, in my opinion, if a visible form element (text input, radio, checkbox, ...) is modified by JavaScript it should be detected on submit as it was in the past.

There may be many people running surveys with custom scripts expecting this behaviour.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Just show one question from randomized group, hide the others 2 years 5 months ago #78949

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Tony-

I just checked all of the question types. The name="SGQA" attribute is always associated with the visual input element (which is usually an id="answerSGQA" code). So, the example in this thread (which changes $('#answerSGQA')) WILL submit the value.

However, EM uses the hidden $('#javaSGQA') variable to process conditions. So, if people change an $('#answerSGQA') value but don't call checkconditions(), the downstream conditions processing won't happen.

So, people's JavaScript should continue to work as expected.
The administrator has disabled public write access.

Just show one question from randomized group, hide the others 6 months 4 weeks ago #105323

Awesome solutions!

Now I'm wondering: Let's say, I want to recycle my questions?

Let's say I want to use a pool of questions 2 times, in two different groups of questions (Q1, and Q2), I have the same ask# questions in each group.

I want to get different ones each time, I think I would have to check that the random generation of numbers, so I don't use the same number in my ask1, and ask2 questions in my poll. Up to them, I was find, but I've tried many times with the if function, but I can't get the work done :(

Can any one help me? :)

Thanks in advance
Last Edit: 6 months 4 weeks ago by javimontano. Reason: Did not explain my issue well :(
The administrator has disabled public write access.

Just show one question from randomized group, hide the others 6 months 4 weeks ago #105341

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6334
  • Thank you received: 817
  • Karma: 243
Hi,

No, if you want user see 2 question, you need 2 question in your survey.

Here you can have this:
- First question : Équation : {RAND(1,2)}
- Q1+Q1b : Relevance equation: RAND==1
- Q2+Q2b : Relevance equation: RAND==2

Denis
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.111 seconds
Donation Image