This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Three of Four fields must have a value. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Three of Four fields must have a value." Watch "Three of Four fields must have a value." New topic

Three of Four fields must have a value.

LaTeef Lusk

Joined: Mar 28, 2009
Posts: 15
I have a script that is not working. I have four form fields, and I want to script to check that at least 3 of the 4 have a value. When I submit the form it seems to bypass the validation. Please help. My script is below: Any help would be appreciated.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19850

And it would also help to know what "not working" means. Read this for information about that: ItDoesntWorkIsUseless.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Wow, you can make that code less complicated.

But how are you calling the validation function?

Travis Hein
Ranch Hand

Joined: Jun 06, 2006
Posts: 161
yea, if you require 3 fields selected, is it important to know which ones not selected.

and maybe this could be called as

Error: Keyboard not attached. Press F1 to continue.
I agree. Here's the link:
subject: Three of Four fields must have a value.
jQuery in Action, 3rd edition