Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

IF statment and color text

  • mirelas
  • mirelas's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #159379 by mirelas
IF statment and color text was created by mirelas
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.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 5 months ago #159383 by Joffm
Replied by Joffm on topic IF statment and color text
Well, that's nothing.

It's "unsupported syntax".
You can read here: manual.limesurvey.org/Expression_Manager...ax_Containing_Errors

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 5 months ago - 6 years 5 months ago #159388 by DenisChenu
Replied by DenisChenu on topic IF statment and color text
Did you try
Code:
{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 , plugin development .
I don't answer to private message.
Last edit: 6 years 5 months ago by DenisChenu.
The topic has been locked.
  • mirelas
  • mirelas's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #159587 by mirelas
Replied by mirelas on 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?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 5 months ago #159610 by DenisChenu
Replied by DenisChenu on 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 , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose