Hi,
I would like to validate the content using javascript in the browser window before form submited. If to be more specific:
I need to get length of submited info from text area and if it's more then certain number I want give user warning and take user back to text area and select all info that
over limit.
How to do this?
Please, advise.
By the way , it will be great to have validation feature in
future releases of TextEditor!
Thank you,
Borys
I would like to validate the content using javascript in the browser window before form submited. If to be more specific:
I need to get length of submited info from text area and if it's more then certain number I want give user warning and take user back to text area and select all info that
over limit.
How to do this?
Please, advise.
By the way , it will be great to have validation feature in
future releases of TextEditor!
Thank you,
Borys

RE: need help with text area validation!
http://wiki.fckeditor.net/FAQ
RE: need help with text area validation!
<html> <head> <script type="text/javascript"> window.onload = function() { var oFCKeditor = new FCKeditor( 'FCKeditor1' ); oFCKeditor.BasePath = '/FCKeditor/'; oFCKeditor.ToolbarSet = 'GL-Minimal'; oFCKeditor.ReplaceTextarea(); } </script> <script type="text/javascript"> if (getEditorValue(FCKeditor1) == "") { alert("Please enter a value for the \"Bio\" field."); theForm.____BIO.focus(); return (false); } return (true); } function getEditorValue( instanceName ) { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance( instanceName ) ; // Get the editor contents as XHTML. return oEditor.GetXHTML( true ) ; // "true" means you want it formatted. } </script> </head> <body> <form action="add_afield.tpl" method="post" enctype="multipart/form-data" onsubmit="return validator(this)"> <textarea id="FCKeditor1" name="____BIO" rows="16" cols="40" wrap="virtual"></textarea><br> <input class="button" type="submit" value="»» Add ««"><br> </form> </body> </html>RE: need help with text area validation!
<html> <head> <script type="text/javascript"> window.onload = function() { var oFCKeditor = new FCKeditor( 'FCKeditor1' ); oFCKeditor.BasePath = '/FCKeditor/'; oFCKeditor.ToolbarSet = 'GL-Minimal'; oFCKeditor.ReplaceTextarea(); } </script> <script type="text/javascript"> if (getEditorValue(FCKeditor1) == "") { alert("Please enter a value for the \"Bio\" field."); theForm.____BIO.focus(); return (false); } return (true); } function getEditorValue( instanceName ) { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance( instanceName ) ; // Get the editor contents as XHTML. return oEditor.GetXHTML( true ) ; // "true" means you want it formatted. } </script> </head> <body> <form action="add_afield.tpl" method="post" enctype="multipart/form-data" onsubmit="return validator(this)"> <textarea id="FCKeditor1" name="____BIO" rows="16" cols="40" wrap="virtual"></textarea><br> <input class="button" type="submit" value="»» Add ««"><br> </form> </body> </html>RE: need help with text area validation!
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
http://www.w3.org/1999/xhtml
Re: need help with text area validation!
Re: need help with text area validation!
i am using the follow code and even tough it works fine alerting me that it is blank it will try to send it even if it returns false ... could any one help me out on this ?
javascript
window.onload = function() { var oFCKeditor = new FCKeditor( 'description' ) ; var sBasePath = '/js/' ; oFCKeditor.BasePath = sBasePath ; oFCKeditor.Width = '100%' ; oFCKeditor.Height = '350' ; oFCKeditor.ReplaceTextarea() ; var oFCKeditor = new FCKeditor( 'solution' ) ; oFCKeditor.BasePath = sBasePath ; oFCKeditor.Width = '100%' ; oFCKeditor.Height = '350' ; oFCKeditor.ReplaceTextarea() ; } function validate() { var description = FCKeditorAPI.GetInstance('description') ; var solution = FCKeditorAPI.GetInstance('solution') ; if (description.GetXHTML() == "" || description.GetXHTML() == null){ alert("Alert: Description is blank."); document.form.description.focus(); return false } else if(solution.GetXHTML() == "" || solution.GetXHTML() == null){ alert("Alert: Solution is blank."); document.form.solution.focus(); return false } else { return true } }form
Re: need help with text area validation!
to:
and
to
SIDE NOTE: the focus need to be write with upper case F.