Reputation: 682
I'm doing some work w/ the JQWidgets grid which requires replacing the value in a column w/ an image. To do this, I need to return a string to the cellsrenderer. In addition, clicking on the icon will perform a Javascript function call, passing several parameters. One of the parameters is a string value, and I'm having difficulty setting up my return string.
The Javascript function I'm calling takes 4 variables - three integers and a string. This is the code for the return:
return "<span style='margin:4px; display:block;'><a href='javascript:;' onclick='unenroll(" + courseID + ", \"courseName\", " + progress + ", " + userID + ")' class='delete-icon' title='<cfoutput>#APPLICATION.LC.getValue("UnassignFrom")#</cfoutput> ' + courseName + '?'><cfoutput>#APPLICATION.LC.getValue("UnassignFrom")#</cfoutput> ' + courseName + '?</a></span>";
courseID, courseName, progress and userID are all Javascript variables; courseName is a string.
As you can see, I've tried escaping the quotes around the courseName w/ slashes, which doesn't work. Neither does encoding Unicode or HTML-entity versions of quotes. I've even tried switching around all the quotes (ie. from single to double and double to single), but still nothing.
Edit - this is what I'm getting back from Firebug: syntax error unenroll(2333, "Exam Automation", 50, )
Upvotes: 1
Views: 954
Reputation: 6030
you just missed some of escaping quotes near "UnassignFrom", here is the correct version:
return "<span style='margin:4px; display:block;'><a href='javascript:;' onclick='unenroll(" + courseID + ", \"courseName\", " + progress + ", " + userID + ")' class='delete-icon' title='<cfoutput>#APPLICATION.LC.getValue(\"UnassignFrom\")#</cfoutput> ' + courseName + '?'><cfoutput>#APPLICATION.LC.getValue(\"UnassignFrom\")#</cfoutput> ' + courseName + '?</a></span>"
Upvotes: 1