//############################################################# //created by : Shamik Verma //created on : 23 aug 2008 //functionality : This function loops on a form fetches all // elements in the form ,if it is a text box // it checks the length of data filled in that // field return an error message if the length // is more than specified . // To use this function : create id for every element in the form // make div whoose id is warning_div.also // add title tag to show error . //############################################################# function check_length() { //alert("we reached js"); var theForm = document.forms[0] var ErrorMsg = ""; var Errors = 0; for(i=0; i50) { ErrorMsg += theForm.elements[i].id+"," ; Errors++; } }//END IF }//End FOR if(Errors>0) { document.getElementById('warning_div').innerHTML = "Length Of fallowing fields are invalid:\n" + ErrorMsg; return false; } }