Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

use end url and attributes to redirect - problem when resuming later

  • asilbering
  • asilbering's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 6 months ago #190326 by asilbering
I found the problem! I was not using the right syntax for EM, and now I corrected it and the redirection works fine.

But if the attribute is NA the survey fails to go to the end page (the "command" COMPLETED doesn't work).

Any ideas?

Thanks!
Ana
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #190327 by tpartner
There is no "command" COMPLETED. Try leaving that out.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • asilbering
  • asilbering's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 6 months ago #190328 by asilbering
Thanks for the quick reply.

As far as I understood I always need to have an expression in case the condition is not met. What should I write there in this case, i.e. how do I indicate that the survey has to finish with its end page?

Thanks!
Ana
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #190331 by tpartner
In 3.x, you don't need a value for a failed condition but try empty quotes.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • asilbering
  • asilbering's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 6 months ago #190332 by asilbering
I tried empty quotes and nothing at all and the result is that I get redirected to the survey registration page where I get asked for a token to start the survey again...

What I need is the survey to go to then end page where I thank the participant if the attribute is NA.

Thanks!
Ana
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #190337 by holch
The problem is that you are basically already on the end page, when the end url is triggered.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #190339 by holch
I was playing around with the demo and something is really strange:
Code:
{if(Q1==1,"http://google.com")}

This doesn't work in the End URL field on the demo (LS 3.19.3) at all.

Seems like the XSS filter is hitting the END URL field or something.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #190340 by tpartner
In that case, you may need to use a JavaScript redirect in the end message instead of the survey end URL.

Something like this:

Code:
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:scriptcomplete',function(){
    $('.completed-wrapper').hide();
 
    if('{TOKEN:ATTRIBUTE_2}' != 'NA') {
      window.location.href = 'http://web-test.xxx.ch/index.php?r=survey/index&amp;sid={SID}&amp;token={TOKEN:ATTRIBUTE_2}&amp;newtest=Y';
    }
    else {
      $('.completed-wrapper').show();
    }
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • asilbering
  • asilbering's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 6 months ago #190343 by asilbering
Thanks holch and tpartner for your feedback!

I will try with the java script then.

Best regards
Ana
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago - 4 years 6 months ago #190366 by DenisChenu
I always use a Equation question for endUrl …

then i can do anything, and update/checking/validate etc … is really more easy : no need to activate survey … :)

And if you need w or > etc …
Use alterna te solution can work
Code:
{if(Q1 lt 1,"http://example.com")}

See : manual.limesurvey.org/Expression_Manager#HTML_editor_issue

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 4 years 6 months ago by DenisChenu. Reason: https://manual.limesurvey.org/Expression_Manager#HTML_editor_issue
The following user(s) said Thank You: tpartner
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #190368 by tpartner
I agree, defining the end URL in an equation question is good practice.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • asilbering
  • asilbering's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 6 months ago #190371 by asilbering
Hi Denis,

could you please be a little bit more specific? (I am still quite a beginner).

What I was doing before (and was working fine in LS 2.05) was to direct to an equation question in the end url field ({myURL}) and then having an if clause in myURL.

This is not working in LS 3.19 anymore.

So your suggestion would be that :
1- I write an if clause in the end url field ({if(Q1 lt 1," example.com ")})
2 - and then the condition related to the attribute in the equation question Q1 ({TOKEN:ATTRIBUTE_2=="NA"})

Did I get it right?

I have tried this with {TOKEN:ATTRIBUTE_2=="NA"} and {TOKEN:ATTRIBUTE_2!="NA"} in Q1 and in both cases after I complete the survey I am directed to the end message, although the attribute is not NA.

Otherwise I will try with the java in the end message field...

Thanks in advance!
Best regards,
Ana
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose