[Javascript] Checking Form Values

David Lovering dlovering at gazos.com
Wed Aug 27 13:05:13 CDT 2003


... or if you want to see if the form object exists at all

  if ( !document.forms["formname"] ) {
      // you are hosed -- no form "formname" present
      // die, by whatever method is most expedient
  }

  Obviously, the method can be extended to deal with forms inside
complicated frame structures, and across windows as well.

  -- Dave Lovering

----- Original Message ----- 
From: "Peter Brunone" <peter at brunone.com>
To: "'[JavaScript List]'" <javascript at LaTech.edu>
Sent: Wednesday, August 27, 2003 9:08 AM
Subject: RE: [Javascript] Checking Form Values


> Hi John,
>
> There isn't really a "null" for form field values; the best you
> can do is to check for an empty string, like this:
>
> if(document.formName.fieldName.value == "") {
> // do your empty-form-field stuff
> }
>
> Cheers,
>
> Peter
>
> -----Original Message-----
> From: javascript-bounces at LaTech.edu On Behalf Of John Gibson
>
> I was wonder ing how to check if a form input is null
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>




More information about the Javascript mailing list