As a guess (I can't test it right now), replace any double
quotes in "item.alias" with "%22" and single quotes with "%27".
The in your javascript, unescape the strings before you use
them. The following shows the principle (the encoding will
occur on your server I guess?):
This doesn't work for me.
At server I've replaced all single and double quotes with %27 and %22
respectively.
And my client page have this code:
<tr>
<td align="left">
<a href="javascript
:
selectItem('${item.code}', '${item.alias}', '${item.descriptions[SPANISH]}', '${item.descriptions[ENGLISH]}');">
${item.alias}
</a>
</td>
<td align="center">${item.code}</td>
<td align="center">${item.descriptions[SPANISH]}</td>
<td align="center">${item.descriptions[ENGLISH]}</td>
<td align="left">${item.tableName}</td>
</tr>
Once it's processed, the resulting code is:
<tr>
<td align="left">
<a href="javascript
:selectItem('1440000002', '03', 'elemento%27uno', 'elemento%27uno');">
03
</a>
</td>
<td align="center">1440000002</td>
<td align="center">elemento%27uno</td>
<td align="center">elemento%27uno</td>
<td align="left">tabla1</td>
</tr>
When I click on the link (a href) I get this error
Error: missing ) after argument list
Source File: javascript
:selectItem('1440000002', '03', 'elemento%27uno', 'elemento%27uno');
Line: 1, Column: 50
Source Code:
selectItem('1440000002', '03', 'elemento'uno', 'elemento'uno');
------------------------------------------^
Also I have tried to unescape the descriptions but with the same results.