I am stuck with a problem here :
I need to output some piece of html code on preview based on the value of a javascript variable. this piece of html code is itself generated in turn by a child tpl which is included based on some condition from the dcr. The sample code is pasted below, and following that is the problem.
I am using iw_ostream to output the generated html in a single line so that document.write works fine.
---------------------------------------------------------------------------------------------------------------------------------------------------------------
The code in tpl:
if(isLoggedIn==false)
{
// User Is not logged in, check if regular login is required then display the relevent module
document.write("<iw_ostream filter='s/[\r|\n]//g'> <iw_if expr=' {iw_value name="serRawDetDcr.serviceRawDetail.loginOptions"/} eq "Regular Login Required"'>
<iw_then>
<iw_include pt="templatedata/commonModules/presentation/modules/related_07_loginbasic.tpl" ><![CDATA[
$iw_param{serviceName} = iwpt_dcr_value('serRawDetDcr.serviceRawDetail.serviceName');
$iw_param{loggedInCopy} = iwpt_dcr_value('serRawDetDcr.serviceRawDetail.loggedInCopy');
$iw_param{linkLabel} = iwpt_dcr_value('serRawDetDcr.serviceRawDetail.loggedInURL.linkLabel');
$iw_param{linkURL} = iwpt_dcr_value('serRawDetDcr.serviceRawDetail.loggedInURL.linkURL');
]]>
</iw_include>
</iw_then>
</iw_if></iw_ostream>");
else
{ .....
Results in to:
if(isLoggedIn==false)
{
// User Is not logged in, check if regular login is required then display the relevent module
document.write(' <div class="moduleSpacer silverBG mod1Wid"><div class="p10a"> <div class="m10b black12BCText">Service -1243</div> <div class="m15b">sdvcvxvc</div>
<form name="loginForm" action="" method="POST" onSubmit="validatePwd('
http://nextelonline.nextel.com/wps/portal/Registration/','1','/login.fcc'); return false;">
<input name="TARGET" value="cvxcvxvc" type="hidden"> <div>Member Name:</div> <input type="text" name="uname" style="width:148px; margin:5px 0 10px 0;"> <div>Password:</div> ');
}
else
{ .....
---------------------------------------------------------------------------------------------------------------------------------------------------------------
****-----**** onSubmit="validatePwd('
http://nextelonline.nextel.com/wps/portal/Registration/','1','/login.fcc'); ****-----****
We are opening and closing the document.write() with single quotes. The form tag is the only part of the HTML code that writes single quotes. This is posing a problem you see. It takes the single quote of the argument to validatePwd as the terminating single quote of document.write . Can any one suggest someworkaround