this is the code of my asp file iam calling the function subfieldvalidation(isn) by passing formanme as argument but it is not initializing it in the script and also giving problem at line starting with #####problem##### i have included one form element ie. textbox please help me out<BR><BR>&#060;%@ Language=javascript %&#062;<BR><BR>&#060;html&#062;<BR>&#060;head&#062 ;<BR>&#060;SCRIPT LANGUAGE="JavaScript" &#062;<BR><BR>function trimStr(strVal){<BR>// trim leading and trailing spaces from the string value.<BR> var start = 0;<BR> var end = strVal.length;<BR> strVal = strVal + "!";<BR><BR> // find first non space char.<BR> for (start = 0 ; strVal.substring(start , start+1) == " " ; start++);<BR><BR> if (start &#060; end) {<BR> // find last space.<BR> for (end = end ; strVal.substring(end-1 , end) == " " ; end--);<BR><BR> return strVal.substring(start, end);<BR> }<BR> else {<BR> return "";<BR> }<BR>}<BR><BR>function getRadioValue(radioObject){<BR>/* Return the value of the radio button */<BR>/* */<BR> var v = "" ;<BR> var i = 0;<BR> var numelements = 0;<BR><BR>/* radioObject = formObject.eval("this." + form_name + "." + radioName);*/<BR><BR> numelements = radioObject.length;<BR> for (i = 0 ; i &#060; numelements ; i++) {<BR> if (radioObject[i].checked == true) {<BR> v = radioObject[i].value;<BR> }<BR> }<BR> return v;<BR>}<BR><BR><BR>function subFieldValidation(formObject) {<BR>/* Validate fields on a form */<BR>/* first get the fields to be validated. */<BR> var i = 0;<BR> var sel = 0;<BR> ######problem######## var fieldList = formObject.FieldValidation.value;<BR> var form_name = "";<BR> <BR> flds = fieldList.split(";");<BR><BR> for (i = 0 ; i &#060; flds.length ; i++)<BR> {<BR> reqs = flds[i].split("+");<BR> /* get the current value of the field. */<BR> switch (reqs[1]) {<BR> case "radio" :<BR> fldVal = getRadioValue( eval("formObject." + reqs[0]) );<BR> break;<BR> case "keyword" :<BR> sel = eval("formObject." + reqs[0] + ".selectedIndex");<BR> if (sel == 0){<BR> fldVal = "";<BR> }<BR> else{<BR> fldVal = eval("formObject." + reqs[0] + "[" + sel + "].text");<BR> }<BR> break;<BR> case "multi-keyword" :<BR> sel = eval("formObject." + reqs[0] + ".selectedIndex");<BR> if (sel == -1){<BR> fldVal = "";<BR> }<BR> else{<BR> fldVal = eval("formObject." + reqs[0] + "[" + sel + "].text");<BR> }<BR> break;<BR> default :<BR> fldVal = eval("formObject." + reqs[0] + ".value");<BR> break;<BR> }<BR><BR>/* if (reqs[1] == "radio"){<BR> fldVal = getRadioValue( eval("formObject." + reqs[0]) );<BR> }<BR> else{<BR> fldVal = eval("formObject." + reqs[0] + ".value");<BR> } */<BR><BR> /* check if the field is empty, but should have a value. */<BR> if (trimStr(fldVal+"") == "")<BR> {<BR> if (reqs[2] == "yes")<BR> {<BR> /* inform user that they need to enter a value in this field */<BR> alert("Please enter a value for " + reqs[3]);<BR><BR> /* set the focus to the field that needs to be completed */<BR> if (reqs[1] == "radio"){<BR> eval("formObject." + reqs[0] + "[0].focus()");<BR> }<BR> else{<BR> eval("formObject." + reqs[0] + ".focus()");<BR> }<BR> return false;<BR><BR> }<BR> } <BR> else<BR> {<BR> //check the Length of the fields required. Must be checked before sent to Oracle<BR> // if the parameter of the validation field is 0, then no specific length is required<BR> var maxLengthStr = reqs[4];<BR> var maxLengthNum = parseInt(maxLengthStr);<BR> if (maxLengthStr == 0) {<BR> //no need to do a check - no length restrictions in PAC III<BR> }<BR> else{<BR> if (fldVal.length &#062; maxLengthNum) {<BR> alert(reqs[3] + " should be a max of " + reqs[4] + " characters, please rectify") ;<BR> eval("formObject." + reqs[0] + ".focus()");<BR> return false; <BR> }<BR> }<BR> /* check the type of field */<BR> if (reqs[1] == "num")<BR> {<BR> n = parseInt(fldVal)<BR> if (isNaN(n))<BR> {<BR> alert("The value for " + reqs[3] + " should be numeric");<BR> eval("formObject." + reqs[0] + ".focus()");<BR> return false;<BR> }<BR> }<BR><BR> } /* end of if fldVal == "" */<BR> } /* end of for */<BR> //<BR> //------------------------------------------------------------------<BR> // 2. ENSURE THE END DATE (IF AVAIL) IS NOT BEFORE THE START DATE<BR> //------------------------------------------------------------------<BR> // 1st check they have entered a Start & End Date <BR><BR><BR> //These VARS NEED to be re-set everytime in case user enters a Date, then removes a date, then re-enters one<BR> var resourceStart = "" ;<BR> var resourceEnd = "" ;<BR> //<BR> //<BR> //FIRST CHECK THE START & END DATES HAVE BEEN ENTERED<BR> //<BR> if (formObject.InitiationDate.value == "" &#124&#124 formObject.TerminationDate.value == "") {<BR> alert("You must enter Start AND End Dates for the Resource");<BR> return false;<BR> }<BR> // * SET THE START DATE TO A JAVASCRIPT DATE VARIABLE (READY TO COMPARE THE 2)<BR> var resourceStartDate = new String(formObject.InitiationDate.value)<BR> var dayNo; dayNo = resourceStartDate.substring(0, resourceStartDate.indexOf("/")) ;<BR> var monthNoa; monthNoa = resourceStartDate.substring(resourceStartDate.inde xOf("/")+1, resourceStartDate.lastIndexOf("/")) ;<BR> var monthNo; monthNo = monthNoa - 1 ;<BR> var yearNo; yearNo = resourceStartDate.substring(resourceStartDate.last IndexOf("/")+1) ;<BR> resourceStart = new Date(yearNo, monthNo, dayNo)<BR> // * SET THE END DATE TO A JAVASCRIPT DATE VARIABLE (READY TO COMPARE THE 2)<BR> var resourceEndDate = new String(formObject.TerminationDate.value)<BR> var dayNo; dayNo = resourceEndDate.substring(0, resourceEndDate.indexOf("/")) ;<BR> // VERY ODD HAPPENINGS HERE<BR> var monthNoa; monthNoa = resourceEndDate.substring(resourceEndDate.indexOf( "/")+1, resourceEndDate.lastIndexOf("/")) ;<BR> var monthNo; monthNo = monthNoa -1;<BR> var yearNo; yearNo = resourceEndDate.substring(resourceEndDate.lastInde xOf("/")+1) ;<BR> resourceEnd = new Date(yearNo, monthNo, dayNo) ; <BR> //NOW COMPARE WHETHER END DATE IS BEFORE THE START DATE<BR> if (resourceStart &#062;= resourceEnd) {<BR> alert("The Resource End Date entered must be AFTER the Resource Start Date") ;<BR> return false ;<BR> }<BR> return true;<BR>}<BR><BR>&#060;/SCRIPT&#062;<BR><BR>&#060;/head&#062;<BR>&#060;title&#062;ttt&#060;/title&#062;&#060;head&#062;<BR>&#060;body&#062;<BR >&#060;form NAME="isn" method="post" ACTION="test.asp" onsubmit="subFieldValidation(isn)" &#062;<BR>&#060;input type =text id=text1 name="FieldValidation" onblur="trimStr(FieldValidation)" &#062;<BR>&#060;INPUT TYPE=submit VALUE="Click me" NAME="submit" &#062; <BR>&#060;/form&#062;<BR>&#060;/body&#062;<BR>&#060;/html&#062;<BR>