fck outputs html with newlines when submitted,
but in cannot take input with newlines as a startup value in the FCKeditor function()
Anyboddy knows, how to get rid of newlines, in PHP, or in javascript, for example in the html_encode() function, where some replacements are made when the input is written.
but in cannot take input with newlines as a startup value in the FCKeditor function()
Anyboddy knows, how to get rid of newlines, in PHP, or in javascript, for example in the html_encode() function, where some replacements are made when the input is written.
RE: value input into FCK
str_replace ( newlines, blanks,$SomeVariable )
RE: value input into FCK
In my view, you never want to modify the original value, the end user may want those carriage returns.
RE: value input into FCK
RE: value input into FCK
I replaced all carriage returns with \n
I replaced all quotes (") with \"
The server side javascript was:
outString = inString.replace(/\"/g,"\\\""); // replace " with \"
outString = outString.replace (/\n/g,"\\n");// replace carriage return with \n
-Dave
RE: value input into FCK
oFCKeditor.Value = "<?php echo $SomeVariable ?>" ;
This works fine without if the variable doesn't have any line breaks in its value, but as soon as you add newlines, not only will it not display the text, but the FCKeditor window doesn't even show up anymore.
Does anyone know any workarounds for this?
RE: value input into FCK
<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>
============
but still fails if html is there