File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 19973

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.
It's not a secret anymore!