- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Failing if test to set end message ?
- deedeel
- Topic Author
- Offline
- New Member
Less
More
2 years 8 months ago #218787
by deedeel
Failing if test to set end message ? was created by deedeel
I have the following situation:
- about 20 survey groups, with each a unique reference saved inside a hidden question (GRREF), prefilled by the URL (GET parameter)
- the reference gets checked for validity (VALTEST question)
- if the reference is invalid, all questions are hidden, and the end message should be set to a "Something went wrong" message
- if the reference is valid, questions are shown, and the end message should be set to a "Thank you" message
I have used information found here to set the end message:
[url] forums.limesurvey.org/forum/development/...ditional-end-message [/url]
For some reason that I cannot fathom, the if test that should set the end message fails, and always sets the "Something went wrong" value.
Hereby attached my .lss test file. I'm using Version 5.0.4+210614.
- about 20 survey groups, with each a unique reference saved inside a hidden question (GRREF), prefilled by the URL (GET parameter)
- the reference gets checked for validity (VALTEST question)
- if the reference is invalid, all questions are hidden, and the end message should be set to a "Something went wrong" message
- if the reference is valid, questions are shown, and the end message should be set to a "Thank you" message
I have used information found here to set the end message:
[url] forums.limesurvey.org/forum/development/...ditional-end-message [/url]
For some reason that I cannot fathom, the if test that should set the end message fails, and always sets the "Something went wrong" value.
Hereby attached my .lss test file. I'm using Version 5.0.4+210614.
Attachments:
The topic has been locked.
- tpartner
- Online
- LimeSurvey Community Team
Less
More
- Posts: 10104
- Thank you received: 3593
2 years 8 months ago #218789
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Failing if test to set end message ?
Several problems...
- VALTEST needs to be an equation type question.
- The relevance for BIRDAT should not reference the VALTEST.question variable, it should should reference VALTEST directly:
- There is no IF() statement in ENDMSG. I should be something like:
Sample survey attached:
- VALTEST needs to be an equation type question.
- The relevance for BIRDAT should not reference the VALTEST.question variable, it should should reference VALTEST directly:
Code:
VALTEST == 'OK'
- There is no IF() statement in ENDMSG. I should be something like:
Code:
{if(VALTEST == 'OK', THANKS.question, INVALID.question)}
Sample survey attached:
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: deedeel
The topic has been locked.
- deedeel
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
2 years 8 months ago #218790
by deedeel
Replied by deedeel on topic Failing if test to set end message ?
Thanks a lot, worked like a charm !
Many wrong assumptions I made..
Could you say when we should reference the ".question" variable, and when we should rather reference the variable directly ?
Many wrong assumptions I made..
Could you say when we should reference the ".question" variable, and when we should rather reference the variable directly ?
The topic has been locked.
- tpartner
- Online
- LimeSurvey Community Team
Less
More
- Posts: 10104
- Thank you received: 3593
2 years 8 months ago #218795
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Failing if test to set end message ?
With equation type questions, you don't need the .question qualifier as equation questions become defined variables in themselves.
- manual.limesurvey.org/Question_type_-_Eq...on#Short_description
- manual.limesurvey.org/ExpressionScript_-...#Access_to_variables
- manual.limesurvey.org/Question_type_-_Eq...on#Short_description
- manual.limesurvey.org/ExpressionScript_-...#Access_to_variables
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: deedeel
The topic has been locked.
- deedeel
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
2 years 8 months ago #218803
by deedeel
Replied by deedeel on topic Failing if test to set end message ?
Not sure whether I should start a new topic, but here is my status: the survey you sent back works perfectly fine, but then, when:
- I remove the two debugging questions (SHOWVALTEST and SHOWENDMSG)
- and I choose "Show welcome screen: On" in "Presentation", the survey gets stuck on that welcome screen, only when VALTEST is invalid
why is that ? I noticed you had disabled the welcome screen: is it incompatible in this case ?
- I remove the two debugging questions (SHOWVALTEST and SHOWENDMSG)
- and I choose "Show welcome screen: On" in "Presentation", the survey gets stuck on that welcome screen, only when VALTEST is invalid
why is that ? I noticed you had disabled the welcome screen: is it incompatible in this case ?
Attachments:
The topic has been locked.
- tpartner
- Online
- LimeSurvey Community Team
Less
More
- Posts: 10104
- Thank you received: 3593
2 years 8 months ago #218820
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Failing if test to set end message ?
That is the expected behaviour. If all questions in the survey are either hidden via question setting or relevance, the survey will not proceed. This is the same in the 3.x LTS version. You will need to add at least one visible question.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- deedeel
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
2 years 8 months ago #218825
by deedeel
But when disabling the welcome screen, it does work fine (i.e. jumps to the end message, when VALTEST is invalid) ?
Replied by deedeel on topic Failing if test to set end message ?
the survey will not proceed
But when disabling the welcome screen, it does work fine (i.e. jumps to the end message, when VALTEST is invalid) ?
The topic has been locked.
- deedeel
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
2 years 8 months ago #218856
by deedeel
Replied by deedeel on topic Failing if test to set end message ?
Still not getting all the subtleties, but after replacing the welcome screen with an always visible "Text display" question, it works as expected.
Thanks !
Thanks !
The topic has been locked.