Check out the LimeSurvey source code on GitHub!

Condition in end message

More
4 years 11 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 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |

Please Log in to join the conversation.

More
4 years 11 months ago #76822 by TMSWhite
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')}

Please Log in to join the conversation.

More
4 years 11 months ago #76842 by DenisChenu

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 (or search sondages pro).

Please Log in to join the conversation.

More
4 years 11 months ago #76847 by waitz
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 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |

Please Log in to join the conversation.

More
4 years 11 months ago #76848 by DenisChenu

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 (or search sondages pro).

Please Log in to join the conversation.

More
4 years 11 months ago - 4 years 11 months ago #76851 by waitz
No no no, I wrote it wrong. It is a closed survey. All participants have a token.

Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
Last Edit: 4 years 11 months ago by waitz.

Please Log in to join the conversation.

More
4 years 11 months ago - 4 years 11 months ago #76862 by DenisChenu

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 (or search sondages pro).
Last Edit: 4 years 11 months ago by DenisChenu. Reason: TOKEN: or NOT ?

Please Log in to join the conversation.

More
4 years 11 months ago #76865 by holch
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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

More
4 years 11 months ago #76873 by waitz

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 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |

Please Log in to join the conversation.

More
4 years 11 months ago #76876 by holch
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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
4 years 11 months ago #76882 by waitz

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 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |

Please Log in to join the conversation.

More
4 years 11 months ago #76885 by holch
Ok, makes sense. I am not very savy in JS, so I can't help.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
4 years 11 months ago #76905 by DenisChenu

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 (or search sondages pro).

Please Log in to join the conversation.

More
4 years 11 months ago - 4 years 11 months ago #76909 by waitz

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 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
Last Edit: 4 years 11 months ago by waitz.

Please Log in to join the conversation.

More
4 years 11 months ago #76912 by DenisChenu

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 (or search sondages pro).

Please Log in to join the conversation.

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