myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger" <mkien...@gmail.com>
Subject Re: Validation questions
Date Wed, 05 Apr 2006 16:14:41 GMT
On 4/4/06, Richard Wallace <rwallace@thewallacepack.net> wrote:
> >     I'm not sure of exactly what I'd do.  At the moment I'm thinking that
> >     the three things that I'd really like to see are more customizable
> >     messages

See below.

> > required being a child element rather than a component attribute

If you really want to do this, the OptionalValidatorFramework provides it.
Stick a SubmittedValueCollectorWalker at the top of the form, stick a
RequiredValidatorChecker at the bottom of the form, remove all
required attributes, and add RequiredValidator validators as
appropriate.

> > and for messages tied to forms in addition to global and
> >     component messages.

That sounds useful, although best practice for JSF is one form per page.
How about designing it as Craig outlined, and submitting it to MyFaces tomahawk?


> One of the big things that does really bother me is defining custom
> messages on a per component basis.  With everything that I've learned
> from this thread I think I understand how to deal with the issues I've
> had up until now.  But not being able to define per component validation
> messages just seems like a fundamental shortcoming.  I'm glad it's being
> addressed in the tomahawk validators by adding a message attribute:
> http://issues.apache.org/jira/browse/TOMAHAWK-169?rc=1
>
> Is the next step with that just extending the standard JSF validators to
> allow them to have the message attribute?  I'm also wondering, can you
> set custom required messages if you use the tomahawk extensions?

Both of these things would be nice to have, but I don't personally
plan on implementing them myself at this time.   It should be easy
enough to copy the code from the standard validators and make them
extend ValidatorBase, creating "t:" versions of each validator.   I
think this would be a good idea, and I'd be happy to commit patches to
do it.

I haven't looked at what it would take to have a custom required
message with the tomahawk extensions.   It'd be worth pursuing.  
Another thing to keep in mind is that JSF 1.2 does address these needs
partially.  So far, it implements a "requiredMessage" UIInput
attribute, with validator/converter attributes to follow.

https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=81

You might also read

https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=103

This is tracked in our system as a JSF 1.2 issue --
http://issues.apache.org/jira/browse/MYFACES-1237

Personally, I think per-validator messages are more useful than one
global validator message.   I've been putting off adding my comments
on this to issue 81 -- done.

Mime
View raw message