Condition in end message

More
8 years 3 months ago #76818 by waitz
I need to include an extra message in the end message, which is only to be shown IF attribute_xx AND attribute_yy equals 1.

Can I do this with js?

Version 2.73.1+171220
The topic has been locked.
LimeSurvey Partners
More
8 years 3 months ago #76822 by TMSWhite
Replied by TMSWhite on topic Condition in end message
In version 1.92, you can do that by embedding expressions like this in the end message (e.g. you don't need JavaScript):
{if(attribute_xx==1 && attribute_yy==1,'message to show if true','message to show if false')}
The topic has been locked.
More
8 years 3 months ago #76842 by DenisChenu
Replied by DenisChenu on topic Condition in end message

TMSWhite wrote: In version 1.92, you can do that by embedding expressions like this in the end message (e.g. you don't need JavaScript):

Just a question Tom : did it work with anonymous survey ?

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.
More
8 years 3 months ago #76847 by waitz
Replied by waitz on topic Condition in end message
I am not sure if I can go to 1.92 at the moment. I have a few import, export and js functions, so I have to test a lot first.

But is it possible with 1.91 and js? No surveys are anonymous

Version 2.73.1+171220
The topic has been locked.
More
8 years 3 months ago #76848 by DenisChenu
Replied by DenisChenu on topic Condition in end message

waitz wrote: But is it possible with 1.91 and js? No surveys are anonymous

If survey is anonymous you can't use TOKEN in your survey ...

( else survey aren't anonymous)

Denis

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.
More
8 years 3 months ago - 8 years 3 months ago #76851 by waitz
Replied by waitz on topic Condition in end message
No no no, I wrote it wrong. It is a closed survey. All participants have a token.

Version 2.73.1+171220
Last edit: 8 years 3 months ago by waitz.
The topic has been locked.
More
8 years 3 months ago - 8 years 3 months ago #76862 by DenisChenu
Replied by DenisChenu on topic Condition in end message

waitz wrote: No no no, I wrote it wrong. It is a closed survey. All participants have a token.

Yep, i understand.

But even with token table, you can set the survey to anonymous. If this is set, then you can't use token table in the survey.

If it's set to no-anonymous, try:
<script type='text/javascript'>
if ("{TOKEN:ATTRIBUTE_XX}"= "1" && "{TOKEN:ATTRIBUTE_YY}"= "1"){
document.write("message to show if true");
}else{
document.write("message to show if false");
}
</script>

Maybe you have to let the user to print answer to use it at end page. And if it not work : try if ("{ATTRIBUTE_XX}"= "1" && "{ATTRIBUTE_YY}"= "1") too.

Denis

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: 8 years 3 months ago by DenisChenu. Reason: TOKEN: or NOT ?
The topic has been locked.
More
8 years 3 months ago #76865 by holch
Replied by holch on topic Condition in end message
If those attributes are already available in the token table, you could just create an extra attribute that indicates those that have both attributes before uploading the token file. Less JS.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
More
8 years 3 months ago #76873 by waitz
Replied by waitz on topic Condition in end message

DenisChenu wrote: If it's set to no-anonymous, try:

<script type='text/javascript'>
if ("{TOKEN:ATTRIBUTE_XX}"= "1" && "{TOKEN:ATTRIBUTE_YY}"= "1"){
document.write("message to show if true");
}else{
document.write("message to show if false");
}
</script>

Maybe you have to let the user to print answer to use it at end page. And if it not work : try if ("{ATTRIBUTE_XX}"= "1" && "{ATTRIBUTE_YY}"= "1") too.

Denis

That's strange. On my local wamp server, none of them work.... {TOKEN:ATTRIBUTE_XX} or {ATTRIBUTE_XX}

Version 2.73.1+171220
The topic has been locked.
More
8 years 3 months ago #76876 by holch
Replied by holch on topic Condition in end message
Wouldn't it be easier to put a page with a boilerplate question for each text? OK, then you would have another page before you finish, but you could work with conditions.

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.
More
8 years 3 months ago #76882 by waitz
Replied by waitz on topic Condition in end message

holch wrote: Wouldn't it be easier to put a page with a boilerplate question for each text? OK, then you would have another page before you finish, but you could work with conditions.

I agree, but the survey is live, and I have lots of users registered. So to be able to add another question, I have to take the survey offline, which I cannot.

Secondly, the information fits perfectly on the confirmation page, so if I can handle it with js, then it is great.

Version 2.73.1+171220
The topic has been locked.
More
8 years 3 months ago #76885 by holch
Replied by holch on topic Condition in end message
Ok, makes sense. I am not very savy in JS, so I can't help.

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.
More
8 years 3 months ago #76905 by DenisChenu
Replied by DenisChenu on topic Condition in end message

waitz wrote: That's strange. On my local wamp server, none of them work.... {TOKEN:ATTRIBUTE_XX} or {ATTRIBUTE_XX}

Hello:
First :
- Just put {TOKEN:ATTRIBUTE_XX} {ATTRIBUTE_XX} to see if it's appear.
Second:
Is the survey is set to "not anonymous"
Did you activate "User can print there answer at end of the survey"

Did you see the print link ?

Denis

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.
More
8 years 3 months ago - 8 years 3 months ago #76909 by waitz
Replied by waitz on topic Condition in end message

DenisChenu wrote: Hello:
First :
- Just put {TOKEN:ATTRIBUTE_XX} {ATTRIBUTE_XX} to see if it's appear.
Second:
Is the survey is set to "not anonymous"
Did you activate "User can print there answer at end of the survey"
Did you see the print link ?
Denis

Yes to all, and it still doesn't work :(

Version 2.73.1+171220
Last edit: 8 years 3 months ago by waitz.
The topic has been locked.
More
8 years 3 months ago #76912 by DenisChenu
Replied by DenisChenu on topic Condition in end message

waitz wrote:

DenisChenu wrote: Hello:
First :
- Just put {TOKEN:ATTRIBUTE_XX} {ATTRIBUTE_XX} to see if it's appear.
Second:
Is the survey is set to "not anonymous"
Did you activate "User can print there answer at end of the survey"
Did you see the print link ?
Denis

Yes to all, and it still doesn't work :(

I test with
- Anonymized responses? This survey is NOT anonymous. (Cannot be changed)
- Participants may print answers? : YES
- {TOKEN:ATTRIBUTE_1} in End message
And all is OK.
Version 1.91+ Build 120302

Denis

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.

Start now!

Just create your account and start using Limesurvey today.

Register now