Welcome to the LimeSurvey Community Forum

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

conditional html code inside ExpressionScript wiped by richtext editor

  • tassoman
  • tassoman's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
2 years 11 months ago #215505 by tassoman
Hello there, I'm writing a "Label Question" just for composing an intuitive interface. This question does a check on answer status, then provide a note with an icon:
Code:
<p>{if(count(that.QFin1.NAOK) == 2 &amp;&amp; count(that.QFin2.NAOK) == 2, '<i class="fa fa-check-square"></i> Questa funzione è stata compilata','<i class="fa fa-pencil-square-o"></i> Questa funzione è incompleta')}</p>

The code is working flawless, showing a nice FontAwesome icon.  The problem is when I go further editing the question, HTML inside ExpressionScripts disappears and gets wiped by the richtext editor, even if I go in Source Mode. Any hint how can I keep HTML persistent inside ExpressionScript conditional command?

«All your survey answers are belong to us »
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 11 months ago #215513 by tpartner
Break it up so the editor doesn't try to "fix" it.

Code:
<p><i class="fa fa-{if(count(that.QFin1.NAOK) == 2 &amp;&amp; count(that.QFin2.NAOK) == 2, 'check-square', 'pencil-square-o')}"></i> {if(count(that.QFin1.NAOK) == 2 &amp;&amp; count(that.QFin2.NAOK) == 2, 'Questa funzione è stata compilata.', 'Questa funzione è incompleta.')}</p>

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: tassoman
The topic has been locked.
  • tassoman
  • tassoman's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
2 years 11 months ago - 2 years 11 months ago #215515 by tassoman
My problem is the logic is much more complicated than "2 ANDs", maybe I can save the logic in a variable?
Code:
{this.COMPLICATED = count(that.QFin1.NAOK) == 2 &amp;&amp; count(that.QFin2.NAOK) == 2}
<p><i class="fa fa-{if(this.COMPLICATED == 1, 'check-square', 'pencil-square-o')}"></i> {if(this.COMPLICATED == 1, 'Questa funzione è stata compilata.', 'Questa funzione è incompleta.')}</p>

Another problem is the output of "if statement", it's manipulated increasing the mess (i'm running 3.x branch)
This is a sample output of generated HTML:
Code:
  <!-- <i class="fa fa-<span id='LEMtailor_Q_5969_2'>pencil-square-o</span>"></i> -->
  Questa funzione è <span id="LEMtailor_Q_5969_3">stata compilata</span>

«All your survey answers are belong to us »
Last edit: 2 years 11 months ago by tassoman.
The topic has been locked.
  • tassoman
  • tassoman's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
2 years 11 months ago #215519 by tassoman
Finally, I simplified "the thing", using UTF8 emoji icons
Code:
<p>Status: {if(count(that.QFin1.NAOK) == 2 AND count(that.QFin2.NAOK) == 2, 'compilata ✅', 'incompleta ✏️')}</p>

«All your survey answers are belong to us »
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 11 months ago #215633 by DenisChenu
Why i'm always on Popup editor ?

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.
  • tassoman
  • tassoman's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
2 years 11 months ago #215662 by tassoman
On LS-3.x PopUp editor is not working when creating a new question, every RichText Popup you ask returns 403 forbidden error. It works only editing already saved questions.

«All your survey answers are belong to us »
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 11 months ago #215663 by tpartner
I cannot reproduce that problem. LS version and environment?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • tassoman
  • tassoman's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
2 years 11 months ago #215664 by tassoman
To me, happens with PHP 7.3 and LS 3.25.x
When I click the popup button trigger, the new windows opens an error page: "invalid group id". Its url is like this:
Code:
https://test.LS/admin/htmleditor_pop/sa/index/name/question_it/text/[Question:](it)/type/question-text/action/newquestion/sid/832251/gid//qid//lang/en
gid and qid are empty using path options kind of url

«All your survey answers are belong to us »
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 11 months ago #215665 by DenisChenu
I think it's already reported and fixed for the popup.

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.

Lime-years ahead

Online-surveys for every purse and purpose