- Posts: 36
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Expression Manager - style/html
- karencheah
- Topic Author
- Offline
- Junior Member
Less
More
9 years 6 months ago #112907
by karencheah
Expression Manager - style/html was created by karencheah
I'm getting into learning how to use Expression Manager and I'm wondering if it's able to conditionally format the output.
I'm creating a table of selected vs correct answers for a quiz type survey, to be displayed at the end. In this table, I would like to highlight (using font colour) the question(s) if the selected answer(s) is incorrect. (Please see table below). I am able to test the condition but I'm not sure how to format to get the red colour. I've tried just putting the html tags around the variable but that doesn't work; ends up displaying the whole thing as html.
Thanks for any advice.
I'm creating a table of selected vs correct answers for a quiz type survey, to be displayed at the end. In this table, I would like to highlight (using font colour) the question(s) if the selected answer(s) is incorrect. (Please see table below). I am able to test the condition but I'm not sure how to format to get the red colour. I've tried just putting the html tags around the variable but that doesn't work; ends up displaying the whole thing as html.
Thanks for any advice.
Question | Selected Answer | Correct Answer |
Q1 | A1 | A4 |
Q2 | A2 | A2 |
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
9 years 6 months ago #112913
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 Expression Manager - style/html
Hi,
Only with the td:
Only with the td:
Code:
<td class="{if(Q1!='A4','error','')}">Q1</td>
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 following user(s) said Thank You: karencheah
The topic has been locked.
- karencheah
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 36
- Thank you received: 2
9 years 6 months ago #112917
by karencheah
Replied by karencheah on topic Expression Manager - style/html
Thanks. Where do I define the class? I've tried to define it just before the table (in source) between <style></style> but that doesn't work (turns up as syntax error).
The topic has been locked.
- steve_81
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 37
9 years 6 months ago - 9 years 6 months ago #112919
by steve_81
Replied by steve_81 on topic Expression Manager - style/html
Hi,
recently I had a same problem, so I try to help.
The style of 'error' should be still defined in the template.css so there is no need for declarate it again.
You could look for it in the template editor in the template.css file. If there is not such a definition you can create one there: e.g.
.
Then you can adress this directly with the solution of DenisChenu:
But I think it should work without an own class.
Best regards
Stefan
recently I had a same problem, so I try to help.
The style of 'error' should be still defined in the template.css so there is no need for declarate it again.
You could look for it in the template editor in the template.css file. If there is not such a definition you can create one there: e.g.
Code:
.error_customer{color:red;}
Then you can adress this directly with the solution of DenisChenu:
Code:
<td class="{if(Q1!='A4','error_customer','')}">Q1</td>
Best regards
Stefan
Last edit: 9 years 6 months ago by steve_81. Reason: Underlining doesn't work within qodes.
The following user(s) said Thank You: karencheah
The topic has been locked.
- karencheah
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 36
- Thank you received: 2
9 years 6 months ago #112929
by karencheah
Replied by karencheah on topic Expression Manager - style/html
Thanks so much! You and DenisChenu are the heroes! It is working as it should now and I've learned something.
Cheers,
Karen
Cheers,
Karen
The topic has been locked.