Welcome, Guest
Username: Password:
  • Page:
  • 1
  • 2

TOPIC: Condition in end message

Condition in end message 4 years 1 month ago #76818

  • waitz
  • waitz's Avatar
  • Offline
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
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 |
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76822

  • TMSWhite
  • TMSWhite's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 758
  • Thank you received: 83
  • Karma: 37
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 administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76842

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 8724
  • Thank you received: 1215
  • Karma: 360
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 ?
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76847

  • waitz
  • waitz's Avatar
  • Offline
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
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 |
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76848

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 8724
  • Thank you received: 1215
  • Karma: 360
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
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76851

  • waitz
  • waitz's Avatar
  • Offline
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
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 1 month ago by waitz.
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76862

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 8724
  • Thank you received: 1215
  • Karma: 360
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
Last Edit: 4 years 1 month ago by DenisChenu. Reason: TOKEN: or NOT ?
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76865

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 4732
  • Thank you received: 689
  • Karma: 209
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.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.
The following user(s) said Thank You: DenisChenu

Condition in end message 4 years 1 month ago #76873

  • waitz
  • waitz's Avatar
  • Offline
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
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 |
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76876

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 4732
  • Thank you received: 689
  • Karma: 209
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.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76882

  • waitz
  • waitz's Avatar
  • Offline
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
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 |
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76885

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 4732
  • Thank you received: 689
  • Karma: 209
Ok, makes sense. I am not very savy in JS, so I can't help.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76905

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 8724
  • Thank you received: 1215
  • Karma: 360
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
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76909

  • waitz
  • waitz's Avatar
  • Offline
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
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 1 month ago by waitz.
The administrator has disabled public write access.

Condition in end message 4 years 1 month ago #76912

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 8724
  • Thank you received: 1215
  • Karma: 360
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
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.279 seconds