[thelist] Javascript if...or statement

Stephen Caudill SCaudill at municode.com
Fri Aug 30 10:05:01 CDT 2002


Here's a javascript question:

  I am performing some validation on a form and want to make sure that at least one of two select fields has been chosen between.  The select fields are being generated via an array in ASP, one a product version and the other a plugin version.  As this is a support request form, I need to ensure at least one has been selected from.  Here's my attempt:

<script type="text/javascript">
function checksubmit()
{
      if
	  (document.Job.VersionType.value == "")
	  ||
	  (document.Job.LFproduct.value == "")
   {
      alert("Please select a Version or Plug-In")
      document.Form.VersionType.focus()
      return false
   }
   return true
}
</script>

I think this must be an improper use of the logical "or".  Can someone advise me as to the correct way to do this?


Stephen Caudill
Web Designer
Municipal Code Corporation
www.municode.com
www.mccimaging.com



More information about the thelist mailing list