Tony-

As long as we document this well, this should not be a problem for users .  Right now, this is mostly an issue for developers.

If we really wanted to be compulsive, we could capture the HTML output and check whether there are EM-related <span> elements within <script> blocks (and provide an appropriate alert), but that is probably overkill.

/Tom

On Mon, Sep 19, 2011 at 10:13 AM, Tony Partner <tpartner@partnersinc.biz> wrote:

Hi Tom,

 

Will this be a problem with uninformed users?

 

As far as I know “if (true){//do something}” is valid script (if not well-formed) so users will invariably try to use something similar.

 

T.

 

From: Thomas White, MD, MS, MA [mailto:tw176@columbia.edu]
Sent: September-19-11 9:47 AM
To: limesurvey-developers@lists.sourceforge.net
Subject: [limesurvey-developers] Important note about ExpressionManager and JavaScript

 

Everyone-

 

Please note the Expression Manager (EM) tries to parse anything surrounded by curly braces UNLESS there is whitespace (e.g. a newline, tab, or space) after the opening curly brace.  So, if you write JavaScript, make sure to add a space or newline after a curly brace (instead of putting it all on one line). Otherwise, your generated HTML will have embedded <span> sections trying to highlight syntax errors.  For example, if you if you had

 

<script>

if (true){bogus}

</script>

 

The output would be this:

 

<script>

if (true)<span title='Undefined variable' style='border-style: solid; border-width: 2px; border-color: red;'><span title='Undefined variable' style='color: #228b22; font-weight: bold'>bogus</span></span>

</script>

 

But if you added the space after the curly brace like this:

 

<script>

if (true){ bogus }

</script>

 

EM would not try to parse it.

 

/Tom






=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 7.0.0.21, Virus/Spyware Database: 6.18280)
http://www.pctools.com
=======


------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the
BlackBerry&reg; mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry&reg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1
_______________________________________________
limesurvey-developers mailing list
limesurvey-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/limesurvey-developers