Form Validation

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Form Validation

Post by Pyrite »

Is there some kind of javascript form validation where I don't have to specify input names or values and it can just check all input text boxes for example on a page and return their values as ones that werne't filled in using a alert box or something. ? Suggestions?
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Check this page http://devedge.netscape.com/library/man ... ml#1193375 for detailed information.

-- Scorphus.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

here's how I'd make the function:

get number of fields in the form
iterate through them checking if the value is empty unless it's a radio, checkbox, select, image, or button. In which case, for radios and checkboxes, see if one of the options is 'checked'. For selects, check the value isn't the default (hopefully blank, or the first one always).. images and buttons aren't checked..

I'd add a name check only to exclude the "optional" fields..
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

See feyd knows what I'm after... thanks for the tip, I'll start writting it soon.
Post Reply