[thelist] Javascript if...or statement

Stevenson Ngila Stevenson at epr.footman-walker.com
Mon Sep 2 01:42:01 CDT 2002


try this::
function checksubmit()
{
      if(document.Job.VersionType.value == "" ||
document.Job.LFproduct.value == "")
   	{
      	alert("Please select a Version or Plug-In")
     	 	document.Form.VersionType.focus()
     	 	return;
  	 }


-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Stephen Caudill
Sent: 30 August 2002 18:01
To: thelist at lists.evolt.org
Subject: [thelist] Javascript if...or statement


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
--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list