struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 34832] - [Shale] Problems with CommonsValidator on the server side.
Date Sun, 29 May 2005 00:46:33 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34832>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

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





------- Additional Comments From craig.mcclanahan@sun.com  2005-05-29 02:46 -------
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > For the issue with the Commons Validator "required" validator, what would 
> it
> > > take to make the Commons Validator version work correctly?
> > This is currently nearly impossible because:
> >     - Validators are never called if the user enters no input.
> >     - The validator doesn't know to which component it is added, so it is
> >       impossible for him to set the required property of the component.
> > A way which should work is a PhaseListener which changes the required 
> > property of the component. I am not sure at the moment whether I like this
> > solution.
> 
> How about creating a "for" attribute like the label component.  If you had the 
> component id, it wouldn't be hard to find the associated component in the 
> component tree.
> 

Unfortunately, Manfred correctly identified why this won't help.  JSF won't call
the validators associated with a field unless the user actually input something
-- which is precisely what the RequiredValidator is designed to check, and (in
turn) is why the "required" property exists on EditableValueHolder components in
the first place.

> My first thought was that maybe the validator tag could fix-up/override a 
> callback expression to the validator from the parent component that would fire 
> the validator or some adapter when the component invokes it's isReqired() 
> method but I think that the expression bound to the required component 
> attribute might already be resolved and wouldn't take the override.  Although, 
> I wouldn't think that "isRequired" method would be fired until the component 
> validate method is invoked as long as the component's required attribute was 
> not explicitly set by the Tag.  Might be to kludge?
> 

I'm starting to like the idea of either a phase listener or perhaps a custom
component somewhere that would go set the required attribte on the corresponding
input field if necessary.  The trick is this has to happen after the component
is created, but before state saving occurs.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message