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

  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 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 5 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 5 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 5 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
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 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 5 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 5 months ago - 4 years 5 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 5 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
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 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 5 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.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago #190380 by DenisChenu

asilbering wrote: 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.

It's my advice : didn't use an eaquation in end url, but create an equation question

Sometimes i have 3 equations question at start of the survey
EndUrl
QuotaOutUrl
OptOutUrl

If it don,'t work on 3.19 : it's really a major issue and must be reported.

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"})

No …

EndUrl equation hidden question

Code:
{ if({TOKEN:ATTRIBUTE_2}!="NA","example.org/survey/212/token/"+{TOKEN}+"/val/"{TOKEN:ATTRIBUTE_2},""}

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.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago #190389 by holch

If it don,'t work on 3.19 : it's really a major issue and must be reported.

I was playing around quick with the end url field and equations and I wasn't able to make it work (within the end url field). Limesurvey did always subsitute parts of the equation (within the end url field directly) with some html code. This happened both, in the demo version and in my own installation.

So it seems like equations in the end URL feature don't really work (or I have some kind of wrong setting, but XSS filter was switched off).

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.
  • asilbering
  • asilbering's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 5 months ago #190390 by asilbering
Thanks Denis and Holch,

I have tried a bit with both approaches (equation in the endurl field and endurl field directing to an equation question with the if clause) and was not able to make it work. I will send a sample survey tomorrow (no time to prepare it today), maybe someone can spot an error... Otherwise I will file a report.

Best regards,
Ana
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose