Keep question editor from changing formatted question text entered in sourcemode

More
1 month 2 weeks ago - 1 month 2 weeks ago #158234 by socius
socius created the topic: Keep question editor from changing formatted question text entered in sourcemode
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]
<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.
<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: 1 month 2 weeks ago by socius. Reason: Added a salutation and an intro :-) - and finally a subject

Please Log in to join the conversation.

More
1 month 2 weeks ago #158238 by LouisGac
LouisGac replied the topic: Keep question editor from changing formatted question text entered in sourcemode
in your account setting, you can disable HTML mode for editor
The following user(s) said Thank You: socius

Please Log in to join the conversation.

More
1 month 2 weeks ago #158241 by socius
socius replied the topic: Keep question editor from changing formatted question text entered in sourcemode
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

Please Log in to join the conversation.

More
1 month 2 weeks ago #158247 by tpartner
tpartner replied the topic: Keep question editor from changing formatted question text entered in sourcemode
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

Please Log in to join the conversation.

More
1 month 2 weeks ago #158248 by DenisChenu
DenisChenu replied the topic: Keep question editor from changing formatted question text entered in sourcemode
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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: socius

Please Log in to join the conversation.

More
1 month 2 weeks ago #158251 by socius
socius replied the topic: Keep question editor from changing formatted question text entered in sourcemode
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

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now