View Single Post
Old 02-13-2013, 12:00 PM   PM User | #1
howard-moore
Regular Coder

 
Join Date: May 2008
Posts: 114
Thanks: 13
Thanked 0 Times in 0 Posts
howard-moore is an unknown quantity at this point
CKEditor textarea validation problem

Hi All,

I have tried putting this to the CKEditor forum but they appear to blank it, so am coming here in desperation.

I use the following script to validate whether someone has added any content to a text area, which also uses the popular, open-source text editor, CKEditor. Without CKEditor it works absolutely fine, but when I use it, it does not recognise the text that has been added until the second click, and so displays the warning message even if text has been added to the textbox.

I have done lots of research on this but cannot understand any of the work-arounds. Can anyone offer any suggestions? My script is:

Code:
<script language="JavaScript" type="text/javascript">
 <!--
function checkform ( form )
 {
   if (form.title.value == "") {
     alert( "Please enter an article TITLE." );
     form.title.focus();
     return false ;
   }
   if (form.content.value == "") {
     alert( "Please check that you have entered an INTRODUCTION." );
     form.content.focus();
     return false ;
   }
   if (form.content2.value == "") {
     alert( "Please check that you have entered a FULL STORY." );
     form.content2.focus();
     return false ;
   }
   return true ;
 }
 //-->
 </script>
Many thanks,
Neil
howard-moore is offline   Reply With Quote