Condition in end message

More
5 years 7 months ago #76818 by waitz
waitz created the topic: Condition in end message
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
5 years 7 months ago #76822 by TMSWhite
TMSWhite replied the 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')}

Please Log in to join the conversation.

More
5 years 7 months ago #76842 by DenisChenu
DenisChenu replied the 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

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

Please Log in to join the conversation.

More
5 years 7 months ago #76848 by DenisChenu
DenisChenu replied the 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 7 months ago - 5 years 7 months ago #76851 by waitz
waitz replied the topic: Condition in end message
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: 5 years 7 months ago by waitz.

Please Log in to join the conversation.

More
5 years 7 months ago - 5 years 7 months ago #76862 by DenisChenu
DenisChenu replied the 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 5 years 7 months ago by DenisChenu. Reason: TOKEN: or NOT ?

Please Log in to join the conversation.

More
5 years 7 months ago #76865 by holch
holch replied the 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'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
5 years 7 months ago #76873 by waitz
waitz replied the 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 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |

Please Log in to join the conversation.

More
5 years 7 months ago #76876 by holch
holch replied the 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'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
5 years 7 months ago #76882 by waitz
waitz replied the 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 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |

Please Log in to join the conversation.

More
5 years 7 months ago #76885 by holch
holch replied the topic: Condition in end message
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
5 years 7 months ago #76905 by DenisChenu
DenisChenu replied the 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 7 months ago - 5 years 7 months ago #76909 by waitz
waitz replied the 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 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
Last Edit: 5 years 7 months ago by waitz.

Please Log in to join the conversation.

More
5 years 7 months ago #76912 by DenisChenu
DenisChenu replied the 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now