Welcome to the LimeSurvey Community Forum

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

Keep question editor from changing formatted question text entered in sourcemode

  • socius
  • socius's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 7 months ago - 6 years 7 months ago #158234 by socius
Dear all,

I have some trouble with the question editor and formatted dynamic output via EM. (And sorry: I think this topic should be filed somewhere else and not under "Can I do this ...")

I'd like to dynamically formulate the question text - which usually works perfectly with the EM.
But: This time I want to use formatting, more specific: an unordered list with bullet points - one bulletpoint appearing for every specific answer the respondent gave in a multiple choice question before, i.e.

q1: Where did you eat at?

A
B
C
D
E
F

q2: What did you eat at [and now the according bullet points]
Code:
<ul>
{implode('', if(q1_1.NAOK == 'Y','<li>q1_1.shown</li>',''),
if(q1_2.NAOK == 'Y','<li>q1_2.shown</li>',''),
if(q1_3.NAOK == 'Y','<li>q1_3.shown</li>',''),
if(q1_4.NAOK == 'Y','<li>q1_4.shown</li>',''),
if(q1_5.NAOK == 'Y','<li>q1_5.shown</li>',''),
if(q1_6.NAOK == 'Y','<li>q1_6.shown</li>',''))}
</ul>


I write this code into the "Source" field. Now the Problem is, that every time I save this question the automatic formatting destroys the code and makes the source look like the code below - if I save the question again (which I do frequently because of formulation details, etc.) the question does not work any more.
Code:
<ul>
  <li>
    {implode('', if(q1_1.NAOK == 'Y','</li>
  <li>
    q1_1.shown</li>
  <li>
    ',''), if(q1_2.NAOK == 'Y','</li>
  <li>
    q1_2.shown</li>
  <li>
    ',''), if(q1_3.NAOK == 'Y','</li>
  <li>
    q1_3.shown</li>
  <li>
    ',''), if(q1_4.NAOK == 'Y','</li>
  <li>
    q1_4.shown</li>
  <li>
    ',''), if(q1_5.NAOK == 'Y','</li>
  <li>
    q1_5.shown</li>
  <li>
    ',''), if(q1_6.NAOK == 'Y','</li>
  <li>
    q1_6.shown</li>
  <li>
    ',''))}</li>
</ul>


Is there a way to preserve the code as it is and keep the editor from formatting it? I hope I did not overlook such a functionality.


Thanks for your time!
Best, G
Last edit: 6 years 7 months ago by socius. Reason: Added a salutation and an intro :-) - and finally a subject
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
6 years 7 months ago #158238 by LouisGac
in your account setting, you can disable HTML mode for editor
The topic has been locked.
  • socius
  • socius's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 7 months ago #158241 by socius
Hi @LouisGac

Thank you! That works well - it seems I can't have it all (preservation of code with some formatting and html-editor), right? Or could I use something like a wrapper around the code that keeps the editor from to adding tags (which is actually really nice - but just not in this case).

Best, G
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 7 months ago #158247 by tpartner
Unfortunately, as far as I know, not without disabling the editor.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: socius
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 7 months ago #158248 by DenisChenu
Set HTML editor in popup. Clearly : i really think it's always the best option.

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: socius
The topic has been locked.
  • socius
  • socius's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 7 months ago #158251 by socius
Thanks to @tpartner and @DenisChenu!

Yes, I also think that the popup html-editor works best - the code stays untouched if I do not explicitly call the html-editor and in case I have to, I just copy the sensitive parts before calling it and put them back in afterwards.

Thanks for your help!
Best, G
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose