Indicate whether an answer is blank or not on review page

More
2 years 8 months ago #118351 by privetlm
privetlm created the topic: Indicate whether an answer is blank or not on review page
I'm dumping all survey questions and answers using this: {qOne.question}: {qOne.shown} .

I'd like to either 1) indicate whether the answer is blank or not. OR 2) color the text of the answer chosen.

Are either one of those (or both) possible? :cheer:

Please Log in to join the conversation.

More
2 years 8 months ago #118372 by tpartner
tpartner replied the topic: Indicate whether an answer is blank or not on review page
1) You should be able to use the is_empty() function:
{if(is_empty(qOne), 'EMPTY', qOne.shown)}

2) Sorry, I don't understand the question.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: privetlm

Please Log in to join the conversation.

More
2 years 8 months ago #118380 by privetlm
privetlm replied the topic: Indicate whether an answer is blank or not on review page
Thank you! Going off #1, is it possible to only show if it's empty? because of the qOne.shown , it's showing the answer as well as the empty.

2) (apologies for poor/unclear wording) I was wondering if it was possible to color the text of the answer after it's referenced(pulled?) in the review page. like, if qOne.shown then text=green

steps:
-user answer q1.
-reference {qOne.question}: {qOne.shown}
and {qOne.shown} would be green

Please Log in to join the conversation.

More
2 years 8 months ago #118381 by tpartner
tpartner replied the topic: Indicate whether an answer is blank or not on review page
1) That is an Expression Manager IF function that will only display one of the strings. Please refer to the documentation - manual.limesurvey.org/Expression_Manager#Conditional_Equations

2) You can try something like this but may need to do it without using the editor (the editor may mangle the HTML syntax):
{if(is_empty(qOne), '<span style="color:red">EMPTY</span>', '<span style="color:green">'+qOne.shown+'</span>')}

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!