...

View Full Version : single quote problem



sanbab
05-23-2005, 11:25 AM
hi,

I am using a pop up window to populate parent window controls.

In the pop up window i have provided a link. if user clicks that link it will populate the parent window.

if the link has any single quote like eg: " san's test " it is not populating and does nothing

please help me

Bill Posters
05-23-2005, 11:36 AM
(edited)

sanbab
05-23-2005, 11:39 AM
how to encode please help

Bill Posters
05-23-2005, 12:10 PM
(edited)

glenngv
05-23-2005, 12:22 PM
You must escape it by using \'

<a href="#" onclick="theFunc('san\'s test');return false;">link</a>

sanbab
05-23-2005, 12:28 PM
htp.p('<td valign=top><input type=hidden name="'||prog_srch_cur.prog_title||'" value="'||prog_srch_cur.program_id||'">');
htp.p('<a href="#" onclick="opener.document.getElementById(''retprogram'').value='''||prog_srch_cur.prog_title||''';
opener.document.getElementById(''retmodule'').value='''';
opener.document.getElementById(''retprogramtype'').value='''||prog_srch_cur.prog_type||''';
opener.document.getElementById(''rettrainingtype'').value=''Managers and Associates'';
opener.document.getElementById(''retstartdate'').value='''||to_char(prog_srch_cur.prog_start_date,'m m/dd/yyyy')||''';
opener.document.getElementById(''retenddate'').value='''||to_char(prog_srch_cur.prog_end_date,'mm/dd/yyyy')||''';
window.close()" class=resultlink>'||prog_srch_cur.prog_title||'</a></td>');
htp.p('<td valign=top class=clientpreview>&nbsp;'||prog_srch_cur.prog_type||'</td>');
htp.p('<td>&nbsp;</td>');

glenngv
05-23-2005, 12:37 PM
What are these characters '|| ||'
Are they server-side code delimiters?

glenngv
05-23-2005, 12:52 PM
If those indeed are server-side delimiters, then this is how I'd fix it.
You can simplify it and make it less confusing by making a function.


function setValues(prog, module, progType, trainingType, startDate, endDate){
if (opener && !opener.closed){ //check if opener is still open
var docId = opener.document.getElementById;
docId('retprogram').value = prog;
docId('retmodule').value = module;
docId('retprogramtype').value = progType;
docId('rettrainingtype').value = trainingType;
docId('retstartdate').value = startDate;
docId('retenddate').value = endDate;
}
window.close();
return false; //cancel href default action
}
...
htp.p('<td valign="top"><input type="hidden" name="'||prog_srch_cur.prog_title||'" value="'||prog_srch_cur.program_id||'">');
htp.p('<a href="#" onclick="return setValues(\''||prog_srch_cur.prog_title||'\', \'\', \''||prog_srch_cur.prog_type||'\', \'Managers and Associates\', \''||to_char(prog_srch_cur.prog_start_date,'m m/dd/yyyy')||'\', \''||to_char(prog_srch_cur.prog_end_date,'mm/dd/yyyy')||'\');" class="resultlink">'||prog_srch_cur.prog_title||'</a></td>');
htp.p('<td valign="top" class="clientpreview">&nbsp;'||prog_srch_cur.prog_type||'</td>');
htp.p('<td>&nbsp;</td>');
Just make sure that those server-side scripts must replace all occurrences of single qoutes (if any) in the values to \'



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum