Validation Function Not Being Used

Results 1 to 2 of 2

Thread: Validation Function Not Being Used

  1. #1
    Join Date
    Dec 1969

    Default Validation Function Not Being Used

    Hi, I have this validation script placed at the top of my code and when I submit the form it seems to just submit without running through the validation,What am I overlooking or what have I forgotten to do? My form is called "AddObjective" and I have included a return Validate(this) in the onSubmit property.<BR><BR>&#060;form method="post" action="SAP_InsrtObjective.asp" name="AddObjective" onSubmit="return Validate(this);"&#062;<BR>etc etc...<BR><BR><BR>&#060;SCRIPT LANGUAGE="JavaScript" type="text/javascript"&#062;<BR>&#060;!-- hide script from older browsers &#062;<BR>function Validate(form)<BR>{<BR> // Make sure Brand is filled<BR> if( document.AddObjective.Brand.value == "None" )<BR> {<BR> alert(&#039;Please select a Brand&#039;);<BR> document.AddObjective.brand.focus();<BR> return false;<BR> }<BR> if( document.AddObjective.Hospital.value == "None" )<BR> {<BR> alert(&#039;Please select a Hospital&#039;);<BR>;<BR> return false;<BR> }<BR>return true;<BR>}<BR>//--&#062;<BR>&#060;/SCRIPT&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Validation Function Not Being Used

    Get rid of the stuff that hide the script from old browsers. You don&#039;t really need it and I&#039;m concerned that the first one, which contains a &#039;&#060;&#039; at the end, might be throwing things off.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts