IF statment and color text

More
1 month 1 week ago #159379 by mirelas
mirelas created the topic: IF statment and color text
Dear All,
I have a question about if statement. I want to put condition: if some certain answer is checked then write some text in a specific colour. But I have a problem to colour that text and put it in a new line, because when I do this for the first time everything is fine and it works properly, but after I do some another changes and save again, I got an error message.
The question looks like this:




Here is some code that works:
What are your answers? (please tick as many boxes as appropriate) {if(( E5_SQ001.NAOK == "Y" ),"WAUTHATISIMPESSIVE","")}
By selecting “X” I get this:
1. What are your answers? (please tick as many boxes as are appropriate) WAU THAT IS IMPRESSIVE
But I want to have a coloured text in a new line, and the code below works:
1. What are your answers? (please tick as many boxes as are appropriate)
{if(( E5_SQ001.NAOK)== "Y","<div></div><span style=color:#ff0000;>WAU THAT IS IMPRESSIVE</span>","")}



But when I click Edit again, I have this
1. What are your answers? (please tick as many boxes as are appropriate) {if(( E5_SQ001.NAOK)== "Y","
<div>
</div>
<span style="color:#ff0000;">WAU THAT IS IMPRESSIVE</span>","")}
When I click Save I get this error:



Any sugestions?


Thanks in advance.
Attachments:

Please Log in to join the conversation.

More
1 month 1 week ago #159383 by Joffm
Joffm replied the topic: IF statment and color text
Well, that's nothing.

It's "unsupported syntax".
You can read here: https://manual.limesurvey.org/Expression_Manager_how-tos#EM_Syntax_Containing_Errors

Joffm

Please Log in to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #159388 by DenisChenu
DenisChenu replied the topic: IF statment and color text
Did you try
{if(( E5_SQ001.NAOK)== "Y","<span style='color:#ff0000;'>WAU THAT IS IMPRESSIVE</span>","")}
And : disable HTML editor. It add the line feed.

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: 1 month 1 week ago by DenisChenu.

Please Log in to join the conversation.

More
1 month 5 days ago #159587 by mirelas
mirelas replied the topic: IF statment and color text
Thank you for your answers.

@Joffm, I understand what kind of mistake it is, but as I already wrote...I don't know how to solve it. And I am looking for "supported syntax" :)

@DenisChenu, I tried this before, but unfortunately, I got the same error after "second" saving. I didn't try to disable HTML editor because I have to write to my administrator to do it, so I wish there was another solution.

Does anyone else have more suggestions?

Please Log in to join the conversation.

More
1 month 5 days ago #159610 by DenisChenu
DenisChenu replied the topic: IF statment and color text

mirelas wrote: @DenisChenu, I tried this before, but unfortunately, I got the same error after "second" saving. I didn't try to disable HTML editor because I have to write to my administrator to do it, so I wish there was another solution.

With HTML editor it always break …

Update the default global settings to put the HTML editor in popup. It's always best.

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
Join our Newsletter!