Conditional end message

More
4 months 1 week ago #163738 by spiceaw
spiceaw created the topic: Conditional end message
Hi,

I'm trying to set a conditional end message, where based on earlier questions I define what to display in end message.

I followed a previous recommandation from Denis :
- Defined a text question (Positive), hidden, with content I want displayed (contains img and script)
- I define for that text question conditions (e.g. question 3 to yes)
- I put in end message {Positive}

If I don't hide my Positive text question, this one appears properly when the condition is met.
But when I hide it and get to the end of the survey, I don't have Positive displayed.

Is there a restriction on what kind of content can be visible in the end message?

Thanks,
Julien

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago - 4 months 1 week ago #163741 by Ben_V
Ben_V replied the topic: Conditional end message
Hi,
try to hide your question using javascript rather than advanced setting (set always visible).

Please paste this snippet in the help textarea for this question
<script>	
	$(document).ready(function() {
		$('#question{QID}').hide();
	});		
</script>

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last Edit: 4 months 1 week ago by Ben_V.

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago - 4 months 1 week ago #163743 by holch
holch replied the topic: Conditional end message
You don't actually need to hide the question. If you use the correct condition or relevance equation (better!) the question only appears if a certain condition is met. If you hide the question via the system it will NEVER be shown, no matter what the condition says.
Sorry, I didn't think this through. The hiding is necessary because of the usage in the end message.

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
Last Edit: 4 months 1 week ago by holch.

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #163756 by spiceaw
spiceaw replied the topic: Conditional end message
Thanks for your suggestions.

I tried setting the question visible and put the js in the help. It doesn't hide the question.
In any case, I still don't see the question text in my end message.

I did a basic testing with
Code:	Test
Question:	Test is working
Help:	
Type:	Text display

In the end Message I have
We thank you for completing this survey.
{Test}

Test is not displayed in the End Message.
It must be the way I'm calling the question text that is not correct.
Is {Test} not the way to do it?

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #163760 by jelo
jelo replied the topic: Conditional end message
Please attach a small survey with the relevant parts.

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #163761 by spiceaw
spiceaw replied the topic: Conditional end message
Here is an export of the relevant part

File Attachment:

File Name: limesurvey...6182.lss
File Size:37 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #163777 by jelo
jelo replied the topic: Conditional end message

Ben_V wrote: try to hide your question using javascript rather than advanced setting (set always visible). $('#question{QID}').hide();

Is that still working under LS 3.0?

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #163781 by jelo
jelo replied the topic: Conditional end message
What version of LimeSurvey is used?

You can hide the question via CSS.



BTW:The English End message html code is a bit broken. Javascript and DIVs.


Can you point me to the workaround Denis showed you?
To me it looks like LS 3.X has a bug. The editor is showing the piping, but the end-message is not containing the variable content.


Under LS 3.2.1. I cannot get the endmessage in preview, only when I activate the survey. Strange.
Attachments:

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #163795 by spiceaw
spiceaw replied the topic: Conditional end message
I'm using Version 3.0.3+180112

Here is what Denis explained me by email once :

Le plus simple étant directement d'ajouter 2 questions de type texte + 1 question Équation.:
TEXTEoui: le texte pour oui
TEXTEnon: le texte pour non
EQUATION: {if(QCODE=="OUI",TEXTEoui.question,TEXTEnon.question)}

Message de fin : {EQUATION}

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #163806 by jelo
jelo replied the topic: Conditional end message
And why didn't you follow his instruction? I cannot see any equation question in your survey.
You directly piped a textdisplay question. Any reason why?

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #163818 by spiceaw
spiceaw replied the topic: Conditional end message
The question Positive has conditions.
But since I couldn't get it displayed in the end message, I tried adding a Test question without conditions to check if the issue was from the conditions.

Isn't it possible to directly pipe a Text Display question?

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #163831 by spiceaw
spiceaw replied the topic: Conditional end message
Thanks all for looking into my problem.

Finally I found what the issue was.
It wasn't due to the question type, just the way I was calling it in the end message.

If someone faces the same issue one day, don't write {Positive} but {Positive.question}

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #163833 by jelo
jelo replied the topic: Conditional end message
There are a lot of things which should be working, but aren't.

First issue: There seems to be a bug, that you cannot get a endmessage in preview.
So you need to activate the survey to see a endmessage.

Second issue: Hiding the question is not working via the javascript in the helptext.
Use CSS class hidden as shown in the screenshot

Third issue: Piping seems not to work as intended.
Change type of question "Positive" to equation. Just change and save. No need to edit question content itself.

Fourth issue:
Piping seems to work with equation type, but it not transporting everything (embedded javascripts seem to be stripped, haven't investigated)



Is there a reason, why Denis isn't suggesting Expression Manager in the endmessage?
Perhaps there is a issue too, bug when trying to show different content depending on answers my first idea would be using Expression manager in the endmessage.

I have submitted bug reports, but that won't help you now.
bugs.limesurvey.org/view.php?id=13317
bugs.limesurvey.org/view.php?id=13320
Attachments:

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago - 4 months 1 week ago #163857 by spiceaw
spiceaw replied the topic: Conditional end message
Thanks for reporting those issues Jelo.

I managed displaying an end message with media and js from a "text display" question but the condition was not followed. So it was displayed in all cases.

I changed the solution by using an "equation" question to analyze the condition.
I got it to work properly to display a basic True/False text.
So I can test if media and js work too, how would you call in place of "true" a text display content in the following expression?
{if(((WouldRecommend.NAOK == "Y") and (( ! is_empty(OverallExperience_1.NAOK) && (OverallExperience_1.NAOK == 1)) or ( ! is_empty(OverallExperience_1.NAOK) && (OverallExperience_1.NAOK == 2)) or ( ! is_empty(OverallExperience_1.NAOK) && (OverallExperience_1.NAOK == 3)))),"TRUE","FALSE")}
Last Edit: 4 months 1 week ago by spiceaw. Reason: edit

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #163863 by spiceaw
spiceaw replied the topic: Conditional end message

jelo wrote:
Fourth issue:
Piping seems to work with equation type, but it not transporting everything (embedded javascripts seem to be stripped, haven't investigated)


You are right.
I found the way to pipe the content I wanted but all html code and script got stripped out.
So I'm stuck at this stage.

How would you go with using EM in the End Message?

Thanks

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!