[thelist] loop through form fields for validation?
Surojit Niyogi
saniyogi at mail.utexas.edu
Thu Apr 26 13:56:22 CDT 2001
I believe the following will work:
function validate(){
//frmName is the name of the form
frmLength = document.frmName.length;
isEmpty = false;
for (i=0; i<frmLength;i++){
if(document.frmName[i].value == "")
isEmpty = true; //one element is empty
}
if(istEmpty)
return false; //at least one element is empty so return false
return true; //all fields are non-empty so return true;
}
This may not be *exactly* what you need but it may help you get started.
-Surojit
----- Original Message -----
From: "Leo Wiedersheim" <leo_wiedersheim at hotmail.com>
To: <thelist at lists.evolt.org>
Sent: Thursday, April 26, 2001 6:29 PM
Subject: [thelist] loop through form fields for validation?
> Was it someone on this list that once provided a javascript to loop
through
> all the elements in a form to validate that there was data in each?
>
> If so would that person mind re-posting? I've just been through evolt
> articles and archives to no avail...
>
> Thanks in advance,
> Leo.
>
>
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.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