[thelist] js help

Joshua Olson joshua at waetech.com
Sun Nov 28 13:35:11 CST 2004


> -----Original Message-----
> From: Alex Beston
> Sent: Sunday, November 28, 2004 2:12 PM
> 
> Im trying to work out how to see if at least one of the 
> fields on a form has been filled out
> 
> how might i go about doing this?

Alex,

There are numerous tutorials available on how to check if a single field is
filled out.  Start there.  Then, extend this logic to the whole form.  You
can loop through all the elements on a field using the following code:

for (el in form.elements) // assuming form references a valid form
{
  // check if it's not empty
  // because if it is, then we're done...
  // so exit indicating "yes"

  // otherwise, move onto the next element
}

An alternate way to loop would be

for (var i = 0; i < form.elements.length; i++)
{
  el = form.elements[i];
  // el now contains a reference to the element
}

Now, if you are looking for specifics on how to interact with form elements,
write JS functions, or how to program, consider coming up with fundamental
questions and search in the evolt archives and/or google.

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168 




More information about the thelist mailing list