We tried a hack to solve a similar issue by having a PhaseListener in
the beforeRender phase that walks the component tree and modifies it (in
our case resetting css styles) on offending components (referenced in
the FacesMessages collection).

It's a bit of an ugly hack and doesn't always work: especially in cases
where there component tree has not been built completely in the before
phase or you have components that behave unexpectedly.

But it's a quick fix if it works for you...

-----Original Message-----
From: Cosma Colanicchia [mailto:[EMAIL PROTECTED]
Sent: Friday, 21 July 2006 5:03 PM
To: MyFaces Discussion
Subject: Re: validation method problem

Usually the type of thing you're trying to do is done this way:

1) Assign an id attribute to each of your input field
2) Place an <h:messages forId="yourComponentId"> instead of your DIV

Now, any conversion/validation error will be rendered near the correct
field. Remember also to use an <h:messages globalOnly="true">
somewhere on your page to display errors that are not bound to any
particular fields. Again, using the Trinidad input components you
don't have to explicitly put an <h:messages> for it, it is done
automatically (unless you disable it with the "simple" attribute).

About the "required" attribute, I've found the JSF behaviour useful
for my apps, but I can understand that is a bit "enforced".

Cosma

2006/7/20, Mike Kienenberger <[EMAIL PROTECTED]>:
> The ability to customize the required message was provided for JSF
1.2.
>
>
https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=
81
>
> There's no easy way to do it in JSF 1.1.
>
> It can be done if you want to spend processing time on it.
>
> The last section of this page will show you how.
>
> http://wiki.apache.org/myfaces/OptionalValidationFramework
>
> You'll want to write your own required-validator (or modify the
existing one).
>
>
> On 7/20/06, array <[EMAIL PROTECTED]> wrote:
> >
> > hi,
> >
> > What I would like to do during the validation is to add a div where
the
> > error message has to be rendered. I have several divs on the page
under each
> > input field which at first are not visible. The corresponding
?rendered?
> > attributes should to be set to true only if the validation fails.
> >
> > I don?t understand only one thing: why is the custom validator not
invoked
> > if the ?required? validator reports an error. I could in my
validator check
> > on null and do what I want!!!
> >
> > Trinidad components that allows a "label" attribute for input
components
> > that can easily be internationalized is a nice thing!
> >
> > Igor
> >
> > --
> > View this message in context:
http://www.nabble.com/validation-method-problem-tf1966234.html#a5415753
> > Sent from the MyFaces - Users forum at Nabble.com.
> >
> >
>

This correspondence is for the named persons only.
It may contain confidential or privileged information or both.
No confidentiality or privilege is waived or lost by any mis transmission.
If you receive this correspondence in error please delete it from your system 
immediately and notify the sender.
You must not disclose, copy or relay on any part of this correspondence, if you 
are not the intended recipient.
Any opinions expressed in this message are those of the individual sender 
except where the sender expressly,
and with the authority, states them to be the opinions of the Department of 
Emergency Services, Queensland.

Reply via email to