Does anyone know how to validate a form using two functions, one triggering
another?

I've got three forms that all contain the same fields, but then each one has
a couple of other fields as well. The onSubmit needs to trigger a specific
function and if that validation passes, it should then trigger the generic
form validation. The two functions work when called independently, but if
the first one validates OK, the form is submitted (ie the second function
doesn't seem to catch validation errors).

Something like this...


<SCRIPT SRC="/javascript/validateRegisterForm.js"...></SCRIPT>
<SCRIPT SRC="/javascript/validateForm.js"...></SCRIPT>

<FORM ACTION="/cgi-bin/sendmail.asp" METHOD="post" onSubmit="return
validateEnrollmentForm(this);">


function validateEnrollmentForm(form) {
   if (someCondition) {
      alert("You forgot the x");
      return false;
   } else {
      validateForm(form)
   }

   return true;
}

function validateForm(form) {
   if (someCondition) {
      alert("You forgot the y");
      return false;
   }

   return true;
}


Thanks if you can help.

-- 
Aidan Whitehall <[EMAIL PROTECTED]>
Macromedia ColdFusion Developer
Fairbanks Environmental +44 (0)1695 51775

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to