commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stewart Cambridge <stewart.cambri...@gmail.com>
Subject [validator] Extending org.apache.commons.validator.Field
Date Thu, 13 Oct 2005 17:26:16 GMT
Dear All,

I'm using the commons validator with Struts and want validations to
not stop at the first failure, but to run against all fields and so
return a set of failures, not just the first one (basically, in a form
of 30 fields, if a user gets several wrong, I can see him getting
annoyed because on each form submission, the next validation failure
is reported, rather than reporting them all at once).

I found an email from Bill Siggelkow <billsigg@bellsouth.net> on Thu,
12 Aug 2004 16:23:17 GMT
(http://mail-archives.apache.org/mod_mbox/jakarta-commons-user/200408.mbox/%3Ccfg5hi$79s$2@sea.gmane.org%3E)
where he hacks the Field class.

Wanting a less hacky solution I tried to extend this class, and put it
in a package that is not org.apache, but com.my.project and have found
several methods and class attributes are either package or private
access.
I wondered if this was deliberate. Would there be any harm in making
private methods protected so they can be extended?

Or is a better solution for me to submit a full fix to the org.apache
class including letting the validate(Map, Map) method take its cue
from the new
<set-property property="stopOnFirstError" value="false"/>
attribute when the validator is plugged in (which is there for the
javcascript as I understand it)
(Even so, I would still want to use protected methods, because maybe
someone else wants to extend the class...)

Or maybe this functionality is already present and I've somehow missed
it in my searching.

Many thanks,

Stewart

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message