cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Double Quotes [Javascript] problem

Former Member
0 Kudos

Hi,

In a BSP application I have a field with F4 help (Popup Page).

F4 Help Page contain search fields and results in tableView, each cell

in tableView is rendered using htmlb_link controller. In event

onclientclick of the htmlb_link I'm using a Javascript method for

passing data back to the calling window.

CONCATENATE 'passDataBack("' browner_id '", "' browner_text '")' INTO
lorv_link->onclientclick.

JavaScript Method has the following body.

function passDataBack(browner_id, browner_text )
{
window.opener.document.getElementById("
<%= controller->mv_js_browner_id %> ").value = browner_id;
<U>window.opener.document.getElementById("
<%= controller->mv_js_browner_text %> ").value = browner_text;
}

IF the data browner_text contain text with double quotes, then I'm

getting Java Script error. I tried encoding the string, double Quote are

converted to &quot; but still, the Java script error is showing.

Please suggest a solution.

Thanks & Regards

Geogy

Accepted Solutions (1)

Accepted Solutions (1)

athavanraja
Active Contributor
0 Kudos

try this


CONCATENATE `passDataBack('`  browner_id `', '` browner_text `' )`  INTO
lorv_link->onclientclick.

Former Member
0 Kudos

Tried the code, it's working for double quotes, but now if data contains single quotes it's creating JavaScript Error.

athavanraja
Active Contributor
0 Kudos

use ESCAPE_JAVASCRIPT method of cl_http_utility class to escape those special characters before using the data in you code.

Former Member
0 Kudos

Thanks for the answer, it works fine.

Answers (0)