Welcome to the LimeSurvey Community Forum

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

Just how to apply CSS on questions (Stupid things)

  • elliotog
  • elliotog's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #270944 by elliotog
OK fine, 

File Attachment:

File Name: limesurvey...4451.lss
File Size:22 KB

lss question in attachment

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #270946 by Joffm
Sorry, I do not see any css in your question text.
 
and get this - obviously.
 

If I enter the snippet
Code:
<style type="text/css">
.fa-exclamation-circle::before {
content: "";
}
</style>
I get this
 
If you entered the snippet and it disappeared you seem to have no rights to do this.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • elliotog
  • elliotog's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #270947 by elliotog
OK thanks for your patience, LimeSurvey is fundamentally not my cup of tea but if my university makes things worse .... ^^'
Have a good evening then !
Elliot

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #270955 by holch
I don't think CSS can be forbidden from within Limesurvey (e.g. via the XSS filter).

So either this is an issue with a custom survey theme used by the university, or it was not implemented correctly.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #270956 by Joffm
Yes, you can.
I won't produce a video to prove.
But here

A normal user (with XSS filter ON)
 

In the sourcecode editor I enter
 
I "Save & Close"
I "Edit" the question again
 


The same in the HTML editor
 
Close the source code, still "maroon"
 
"Save & Close" and "Edit"
 
Gone.

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 1 week ago #270991 by holch

Yes, you can.
I won't produce a video to prove.


No need to produce a video. I trust you on that one.

So either I had false information in my head or the XSS filter got stricter over the years.

I never use it on my installations, so I wouldn't notice. Good to know that it also filters simple CSS code.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • elliotog
  • elliotog's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 1 week ago - 1 month 1 week ago #270993 by elliotog
Thank you Joffm for your maroon example, I've tried and very interesting, it works on the question text input (the question becomes indeed colored)
 
but when I preview the question, the style disappears, it becomes  
,

Should I contact my university to fix it ?
 
Last edit: 1 month 1 week ago by elliotog.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 1 week ago #270994 by holch
To be honest, the initial snippet didn't work for my LS6 either. Might be because in LS6 the exclamation mark seems to be a question mark. But I didn't have much time to test more.

Your installation seems to be LS5, so this might be the difference. Didn't have a chance to test in LS5, but I assume Joffm did so.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 1 week ago - 1 month 1 week ago #270995 by holch

but when I preview the question, the style disappears, it becomes  
,

Should I contact my university to fix it ?

 
Can you show the code that you have put? Because this looks like limesurvey is trying to read it as expression script (instead of CSS), but can't find the variables.

If you could show the code when you put it, and then the code when you saved it and open it again?

My suspicion is that there is something wrong with the code used.

Could be that the XSS filter is deleting only parts of the code and that it deems "dangerous" and leaves other things, like the "color:blue;" part.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
Last edit: 1 month 1 week ago by holch.

Please Log in to join the conversation.

  • elliotog
  • elliotog's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 1 week ago #271004 by elliotog

Can you show the code that you have put? Because this looks like limesurvey is trying to read it as expression script (instead of CSS), but can't find the variables.


<span style="font-size:12pt;"><span style="line-height:107%;"><span style="font-family:Garamond, serif;">Quelle est votre année de naissance ? </span> </span> </span>
<style type="text/css">body {color: blue;}
</style>

But when I return on this question, the code becomes : 
<span style="font-size:12pt;"><span style="line-height:107%;"><span style="font-family:Garamond, serif;">Quelle est votre année de naissance ? </span> </span> </span> {color: blue;}
which does not work 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 1 week ago #271005 by Joffm
Here there is indeed a mistake in your syntax.
In javascript and css there has to be a blank after an opening curly bracket and before a closing curly bracket.

Otherwise Limesurvey takes it as expression.

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 1 week ago #271007 by holch
Hmmm, setting the HTML body within a question doesn't make much sense for me. What are you trying to achieve?

So it seems like XSS filter is filtering the style tags and leaves you with just {color:blue;} and then everything in between the {} is interpreted like expression script.

What are you actually trying to achieve with this code?
Code:
<style type="text/css">
body {color: blue;}
</style>

Because the code you are using would attribute the blue color to all text ( www.w3schools.com/cssref/pr_text_color.php ) within the body-tag, which is basically the tag that surrounds the whole visible part of a website.

But in any way, it seems to be clear that the XSS filter is on and is filtering the style tags in your installation.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose