I struggle with some conditions issue in assessment survey.
When I use short condition like this:
{if (P102.NAOK == "A4", "Some answer", "Other answer")} it works perfectly.
but when I try to make the response longer e.g.
{if (P102.NAOK == "A4", "Some answer",
"Longer text longer longer longer Other answer
couple of lines of text
couple more
even more lines
more lines")}
it doesn't work. What's wrong?
If it is a problem with longer text, is there any workaround (calling external php script)?
Is it possible to do some actions based on questions response via javascript?
You can maintain HTML tags if you use htmlentities() and html_entity_decode().
So, something like this in the equation question:
Code:
{htmlentities('Some text displayed if Q1 == "A1"<br />...and some more on a new line<br />...and some <strong style="color:red;">bolded red text</strong>.')}
And, something like this where you want to display the text:
The combination of both solutions seems to do the trick. I used hidden questions for long text response and "if statement" to decide what answer to show. html_entity_decode works like a charm (no worries with formatting sign etc.)
Pls find below one of the code line that do the trick