Javascript - array declaration error - assessment

More
2 years 5 months ago #121295 by arunicbe
arunicbe created the topic: Javascript - array declaration error - assessment
I display a bar chart in my assessment result. I have tested the bar
chart java script in html file. It works perfect.

When I include this script in the assessment rule message, an array variable declaration showing error at runtime.

Below is the variable declaration showing error:
var data = [{data: 0,0, color:"white"},
{data: 1,12, color: "yellow"},
{data: 2,3, color: "green"},
{data: 3,5, color: "red"},
{data: 4,5, color: "orange"},
{data: 5,6, color: "grey"},
{data: 6,0, color: "white"}];

I tried by escaping the { braces also. I still get the same error.

var data = [\{data: 0,0, color:"white"\},
\{data: 1,12, color: "yellow"\},
\{data: 2,3, color: "green"\},
\{data: 3,5, color: "red"\},
\{data: 4,5, color: "orange"\},
\{data: 5,6, color: "grey"\},
\{data: 6,0, color: "white"\}];

Attachments:

Please Log in to join the conversation.

More
2 years 5 months ago #121306 by first
first replied the topic: Javascript - array declaration error - assessment
curly brackets are special characters in LS. Use your javascript in external js file.

Survey Designer and Programmer

Please Log in to join the conversation.

More
2 years 5 months ago #121332 by DenisChenu
DenisChenu replied the topic: Javascript - array declaration error - assessment
Or put space after { and space before }

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: arunicbe

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!