Hi all,
I have been bugging the issue for past 6 days but no luck so finally posting here.
I have a form where i have placed the textarea, once i click on the submit button the form is submitted.
iam doing a serverside validation for the posted values, if all the data is correct then iam ineserting teh values into Db, else Iam showing the error messages.
ISSUE : If the error occurs the values enterered previously is not been shown in the textarea.
Below mentioned is the code.
Thanks for your time....
Best wishes
I have been bugging the issue for past 6 days but no luck so finally posting here.
I have a form where i have placed the textarea, once i click on the submit button the form is submitted.
iam doing a serverside validation for the posted values, if all the data is correct then iam ineserting teh values into Db, else Iam showing the error messages.
ISSUE : If the error occurs the values enterered previously is not been shown in the textarea.
Below mentioned is the code.
<script type="text/javascript">
var ableToDisplayHtmlEditor = true;
function FCKeditor_OnComplete( editorInstance ) {
var format = document.mainform.plate_format.value;
var editor = FCKeditorAPI.GetInstance('plateTEXT_html');
if (format=="text/html" && ableToDisplayHtmlEditor == true) {
document.getElementById('div_plateTEXT_text').style.display = 'none';
document.getElementById('div_plateTEXT_html').style.display = 'block';
var text = document.mainform.plateTEXT_text.value; //.replace(/\\n/g,"<br/>");
editor.EditorDocument.body.innerHTML = text;
alert("text... :" + text);
if(!document.all) editor.MakeEditable();
} else {
document.getElementById('div_plateTEXT_text').style.display = 'block';
document.getElementById('div_plateTEXT_html').style.display = 'none';
}
}
function displayFCKEditor (focus) {
var format = document.mainform.plate_format.value;
var editor = FCKeditorAPI.GetInstance('plateTEXT_html');
if (format=="text/html" && ableToDisplayHtmlEditor == true) {
document.getElementById('div_plateTEXT_text').style.display = 'none';
document.getElementById('div_plateTEXT_html').style.display = 'block';
var text = document.mainform.plateTEXT_text.value; //.replace(/\\n/g,"<br/>");
editor.EditorDocument.body.innerHTML = text;
if(!document.all) editor.MakeEditable();
if (focus == 'true') editor.Focus();
} else {
document.getElementById('div_plateTEXT_text').style.display = 'block';
document.getElementById('div_plateTEXT_html').style.display = 'none';
document.mainform.plateTEXT_text.value = editor.EditorDocument.body.innerHTML; //.replace(/<br>|<br\\s*>/gi,"\\n").replace(/ /gi," ");
if (focus == 'true') document.mainform.plateTEXT_text.focus();
}
}
</script>
EOM;
$IPX2 = "<SELECT name=\"plate_format\" class=\"body\" onChange=\"javascript:displayFCKEditor('true');\">\n";
$IPX2 .= "<option value=\"text/plain\" ".($plate_format == 'text/plain' ? "SELECTED" : "")." >Plain Text</option>\n";
$IPX2 .= "<option value=\"text/html\" ".($plate_format == 'text/html' ? "SELECTED" : "").">HTML</option>\n";
$IPX2 .= "</SELECT>";
$PLATE_DATA .= <<<EOM
<TR BGCOLOR="#eeeeee">
<TD COLSPAN=2 CLASS=body VALIGN=TOP><b>Email Format:</b> ${IPX2}</TD>
</TR>
<TR BGCOLOR="#eeeeee">
<TD COLSPAN=2 CLASS=body VALIGN=TOP>
${IPX}
<script type="text/javascript" src="FCKeditor/fckeditor.js"></script>
<script type="text/javascript">
try{
var oFCKeditor = new FCKeditor( 'plateTEXT_html' ) ;
oFCKeditor.BasePath = "FCKeditor/" ;
oFCKeditor.ToolbarSet = 'MY Template' ;
oFCKeditor.Width = "100%" ;
oFCKeditor.Height = 400 ; // 400 pixels
oFCKeditor.ReplaceTextarea() ;
} catch (e) {
alert("Failed to create HTML Editor. Only Plain Text available. Error name: " + e.name
+ ". Error message: " + e.message);
ableToDisplayHtmlEditor = false;
if(document.mainform.plate_format.options[1]) {
document.mainform.plate_format.options[1]=null;
}
}
</script>
</DIV>
</TD>
</TR>
Thanks for your time....
Best wishes

Re: Retriving posted values
Figured out the issue, Hope it will help someone.
Actually I jsut called $posted_fieldname ($plateTEXT)/
Now able to get the posted values but the next issue is if iam using <br /> or \n or anyother HTML characters it gives me an error " unterminated string literal".
Kindly suggest
Re: Retriving posted values
Frederico Knabben
CKEditor Project Lead and CKSource Owner
--
Follow us on: Twitter | Facebook | Google+ | LinkedIn
Re: Retriving posted values
Iam not hardcoding \n, infact when i press enter in the textarea it gets conveerted to \n which is casuing me the problem.
Can you please guide me how to achive this in javascript...
Thanks
Re: Retriving posted values
Frederico Knabben
CKEditor Project Lead and CKSource Owner
--
Follow us on: Twitter | Facebook | Google+ | LinkedIn
Re: Retriving posted values
I have enter the contents as
Simple text based data now I will enter the new line
this is the new line data
the Output in firebug is
The error which i get is
Re: Retriving posted values
... or even to the following, based on your needs:
Frederico Knabben
CKEditor Project Lead and CKSource Owner
--
Follow us on: Twitter | Facebook | Google+ | LinkedIn
Re: Retriving posted values
please help me out