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!
I just found this answered in the FAQ on the Wiki -
http://wiki.fckeditor.net/FAQ
you use FCKeditorAPI.GetInstance to get the editor object, then GetXHTML to get its contents... there's also a wiki page about the JavaScript API that makes that all possible
RE: need help with text area validation!
RE: need help with text area validation!
RE: need help with text area validation!
Hi Friends
here is the solution:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script>
function getEditorValue()
{
// Get the editor instance that we want to interact with.
var s = FCKeditorAPI.GetInstance('title') ;
alert(s.GetXHTML());
if(s.GetXHTML()==""||s.GetXHTML()==null)
{
alert("blank FCk");
//var HTML=document.getElementById("t1").value;
//s.InsertHtml(HTML);
}
else{
alert("fck is filled");
}
}
</script>
</head>
<body>
<form>
<!--input type="text" value="love is on the air" id="t1" name="t1"/-->
<script type="text/javascript" src="FCKeditor/fckeditor.js"></script>
<textarea name="title" rows="5" id="title" >This is <b>the</b> initial value.</textarea>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'title' ) ;
oFCKeditor.BasePath = "FCKeditor/" ;
oFCKeditor.ToolbarSet = 'small';
oFCKeditor.ReplaceTextarea() ;
}
</script>
<input type="button" value="check data" onclick="getEditorValue()"/>
</form>
</body>
</html>
Re: need help with text area validation!
harpreetanny,
You saved my life! Thanks a lot for the example.
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
form
Re: need help with text area validation!
to:
and
to
SIDE NOTE: the focus need to be write with upper case F.