Check out the LimeSurvey source code on GitHub!

Extract current subject number for conditional hiding

5 years 2 months ago #70534 by kuehnik
Can I use the current subject number in a hidden text question to conditionally show/hide a subsequent question?

E.g.: Show a question to all subjects with even subject number and hide it from all subjects with odd subject number?


Please Log in to join the conversation.

5 years 2 months ago #70542 by Mazi
Have a look at the conditions wiki page:

Theoretically it should be possible using a regular expression but I have never tried:

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)'"

Please Log in to join the conversation.

5 years 2 months ago #70554 by tpartner
By "current subject number" do you mean the response ID?

If so, you can use the {SAVEDID} placeholder to retrieve it but only after a question page has been submitted.

Then it would be fairly easy to use the JavaScript modulus operator to determine whether the ID was odd or even and populate a hidden question accordingly.

Tony Partner

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

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form