- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
IF statment and color text
- mirelas
- Topic Author
- Offline
- New Member
Less
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.
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12713
- Thank you received: 3926
6 years 5 months ago #159383
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
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
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
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13910
- Thank you received: 2546
6 years 5 months ago - 6 years 5 months ago #159388
by DenisChenu
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.
Replied by DenisChenu on topic IF statment and color text
Did you try
And : disable HTML editor. It add the line feed.
Code:
{if(( E5_SQ001.NAOK)== "Y","<span style='color:#ff0000;'>WAU THAT IS IMPRESSIVE</span>","")}
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
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?
@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
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13910
- Thank you received: 2546
6 years 5 months ago #159610
by DenisChenu
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.
Replied by DenisChenu on topic IF statment and color text
With HTML editor it always break …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.
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.