<SCRIPT language="javascript">
var article = '<br /><br />&lt;B style=&quot;FONT-SIZE: 14px&quot;&gt;WASHINGTON (CNN) --[/b] &lt;B style=&quot;FONT-SIZE: 14px&quot;&gt;President Bush had what the White House described as a &quot;businesslike&quot; phone conversation Tuesday with French President Jacques Chirac, the first time the two leaders have spoken since the beginning of war with Iraq, which France adamantly opposed.[/b]
<br /><br />While a spokeswoman for the French leader called the conversation &quot;positive,&quot; the White House assessment of the conversation was cooler. ';
CreateFCKeditor("newsedit", 650, 400, "newsedit", article);
</SCRIPT>
I am still geting a javascript error: Unterminated String Constant
HELP!
var article = '<br /><br />&lt;B style=&quot;FONT-SIZE: 14px&quot;&gt;WASHINGTON (CNN) --[/b] &lt;B style=&quot;FONT-SIZE: 14px&quot;&gt;President Bush had what the White House described as a &quot;businesslike&quot; phone conversation Tuesday with French President Jacques Chirac, the first time the two leaders have spoken since the beginning of war with Iraq, which France adamantly opposed.[/b]
<br /><br />While a spokeswoman for the French leader called the conversation &quot;positive,&quot; the White House assessment of the conversation was cooler. ';
CreateFCKeditor("newsedit", 650, 400, "newsedit", article);
</SCRIPT>
I am still geting a javascript error: Unterminated String Constant
HELP!

RE: Why this Error?
<SCRIPT language="javascript">
var article = '<br ... CNN) --[/b] '+
'...'+
'...'+
'...';
CreateFCKeditor("newsedit", 650, 400, "newsedit", article);
</SCRIPT>
should work fine.
RE: Why this Error?
I found if you remove the newline characters before assigning the fckEditor.value value, all is good.
In php, you can use the following:
$newText = str_replace(chr(10), "", $originalText);
$newText = str_replace(chr(13), "", $newText);
this worked for me.
RE: Why this Error?
Even though I code in ASP, I found these answers very useful. So thank you all. And for those of us that use ASP to retrieve DB info and place it in the editor, here is a sample of how to fix the "unterminated string" error with new line characters.
You will find that you can do multiple tests, but if you look at the results, you will find that you really only need one test (the first one).
As well, these tests should be done BEFORE assigning the DB text value to the editor textarea.
sample code :
<%
dim fldval
fldval = trim(rsRecordset("fldvalue"))
response.Write "<br><br>**************<br>Start of string<br>" & fldval & "<br>End of string<br>"
'find carriage return and line feed constants
if instr(1,fldval,vbcrlf) then
fldval = replace(fldval,vbcrlf,"")
response.Write "<br>vbcrlf found"
else
response.Write "<br>vbcrlf not found"
end if
'find carriage return constant
if instr(1,fldval,vbcr) then
fldval = replace(fldval,vbcr,"")
response.Write "<br>vbcr found"
else
response.Write "<br>vbcr not found"
end if
'find line feed constant
if instr(1,fldval,vblf) then
fldval = replace(fldval,vblf,"")
response.Write "<br>vblf found"
else
response.Write "<br>vblf not found"
end if
'find shift+return (line feed) character code
if instr(1,fldval,chr(10)) then
fldval = replace(fldval,chr(10),"")
response.Write "<br>10 found"
else
response.Write "<br>10 not found"
end if
'find return (carriage return) character code
if instr(1,fldval,chr(13)) then
fldval = replace(fldval,chr(13),"")
response.Write "<br>13 found"
else
response.Write "<br>13 not found"
end if
%>
RE: Why this Error?
<TABLE width=80% border=0 cellpadding=2>
<FORM method=POST enctype='multipart/form-data'>
<INPUT type=hidden name=mode value="update">
<INPUT type=hidden name=header_content_id value="<? echo $row["header_content_id"]; ?>"><TR>
<TD bgcolor=DDDDDD><b>Content Name : </b></TD>
<TD bgcolor=EEEEEE><INPUT type=text size=24 name=header_content_name value="<? echo $row["header_content_name"]; ?>"></TD></TR>
<TR>
<TD bgcolor=DDDDDD valign=top><b>Content : </b></TD>
<TD bgcolor=EEEEEE>
<?php function prepTextForEditor($in) { $out = str_replace(chr(10), "", $in); $out = str_replace(chr(13), "", $out); return str_replace("'", "\'", $out); } $strTEXT = $row["header_content"]; ?><script type="text/javascript">
var oFCKeditor = new FCKeditor( 'header_content' ) ;
oFCKeditor.Height = 300 ; // 400 pixels
oFCKeditor.Width = "100%" ; // 250 pixels
oFCKeditor.Value = "<?php echo prepTextForEditor($strTEXT);?>" ;oFCKeditor.Create() ;
</script>
</TD>
</TR>
<TR>
<TD bgcolor=DDDDDD valign=top><b>Active : </b></TD>
<TD bgcolor=EEEEEE><INPUT type=checkbox name=header_content_active value="Y"<? if ($row["header_content_active"] == "Y") echo " checked"; ?>></TD></TR>
<TR>
<TD colspan=2><INPUT type=submit value="Update Content"> <INPUT type=button value="Cancel" onClick="self.location='header_content.php'"></TD>
</TR>
</FORM>
</TABLE>
RE: Why this Error?
/*
function prepTextForEditor($in)
{
$out = str_replace(chr(10), "", $in);
$out = str_replace(chr(13), "", $out);
return str_replace("'", "\'", $out);
}
*/
Re: Why this Error?
thisContent = rs("pageData")
thisContent = replace(thisContent,"'","\'")
if instr(1,thisContent,vbcrlf) then
thisContent = replace(thisContent,vbcrlf,"")
elseif instr(1,thisContent,vbcr) then
thisContent = replace(thisContent,vbcr,"")
elseif instr(1,thisContent,vblf) then
thisContent = replace(thisContent,vblf,"")
elseif instr(1,thisContent,chr(10)) then
thisContent = replace(thisContent,chr(10),"")
elseif instr(1,thisContent,chr(13)) then
thisContent = replace(thisContent,chr(13),"")
end if
<script language="javascript" type="text/javascript">
window.onload = function()
{
document.f1.fck1.value='<%=thisContent%>';
}
</script>
Thanks all of you