Check out the LimeSurvey source code on GitHub!

Suddenly not possible to enter javascript code

4 years 11 months ago #75974 by Opf14
I am using javascript and have done it succesfully by adding script code in the question text field.

But suddenly it is not possible anymore. When I click the update questiontext button it shows a blank internet explorer page. And the entered data has not been saved. I have tried putting in only the script tags to make sure that it was not a coding error but same result. If I remove the script tag it saves normally.

The Filter HTML for XSS" is set to "Off" as it should.

Any help is greatly appriciated!!!

Please Log in to join the conversation.

4 years 11 months ago #76002 by TMSWhite
Which version are you using?

Please paste a sample of the JavaScript code having trouble.

If you are using 1.92, you need to check your JavaScript code for two things:

(1) all opening curly braces must have a whitespace (a space, tab, or newline) after them, and all closing curly braces must have whitespace before them (otherwise Expression Manager will think that your JavaSript code should be parsed as an Expression, and it will say that your variables are not defined.

(2) If you do any regular expression parsing within JavaScript, and your regular expressions use curly braces (like us_phone.match(/\d{3}-\d{3}-\d{4}/)), you can not use the in-line regular expression syntax. You must create a a new RegExp() object like this RegExp('/\d{3}-\d{3}-\d{4}/') and use it in the matching, otherwise Expression Manager will think that you are trying to evaluate {3}


Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form