At 1:36 PM -0400 7/18/05, Laurie Harper wrote:
Harland, David wrote:
I have three checkboxes that can all either be unchecked or only one can
be checked.

How do I create a Validator rule for this. I don't think it is possible
to do this neatly as I think you will always get more than one of the
same error message. Can someone please tell me if I am right.

You may be able to do what you want with validwhen, though it might get a bit hairy. If only one checkbox should be selected, maybe you could use radio buttons instead? Failing that, you may need to plug in your own custom validator (see [1] for details).

There is an open Bugzilla ticket which offers a powerful "expression" validator to Struts; it was written by one of my colleagues, and I think it's pretty hot stuff. There are some discussions underway about the best way to add it to Struts right now, but in the meantime, if you were so motivated, you could pick your way through the ticket and apply the patches to your own project.

It works well and once you have it implemented, it's quite straightforward (much more so, in my opinion, than "validwhen" or "requiredif"). If you just create all the specified new classes in your project's own package space and add dependencies to a few things, you should be all set.

See http://issues.apache.org/bugzilla/show_bug.cgi?id=34849

Joe

--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to