myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <>
Subject Re: Any way to disable/sidestep converters/validators while processing a ActionListener event?
Date Thu, 02 Feb 2006 03:56:54 GMT
Senior Consultants Inc. wrote:
> Hello:
> We would like to be able to handle the ActionListener event without
> converters
> and validators (associated with fields on the form) generating error
> messages.
> When the form is submitted, we do want the field converters and validators
> to
> generate appropriate error messages.  Is there a way to disable/sidestep
> converters and validators while processing an ActionListener event?  Further
> details are provided below.
> The situation:
> --------------
> 1. Have a date input field
> 2. Have a link next to the input field that is used to set a default value
> in the date field.
>    An ActionListener is associated with the link.
> 3. When the link is clicked, the form is posted and the ActionListener
> method is invoked.  This
>    method sets and default value in the date field and returns.
> 4. Since it is an ActionListener event, JSP redisplays the same page.
> Problem:
> --------
> 1. If an illegal date format has been entered into the date field before
> clicking the link,
>    the converter on the date field detects an error.  JSF redisplays the
> page with the
>    error message.
> 2. Even if the date field is empty or has a legal value, other fields on the
> form can have
>    bad values such that their converter or validator will detect an error.
> Again, JSP
>    redisplays the page with the error message.
> UI Goal:  Have the link set the default value and ignore any illegal fields
> on the form.
> -------   At this point in time, the user in interested in defaulting the
> date field, not
>           validating fields.  The fields will be validated when the form is
> submitted.
> Current Solution:
> -----------------
> 1. The link has: immediate="true" set.
> 2. ActionListener associated with link runs early in the JSF lifecycle. This
> method
>    accesses the component and sets the date value by calling
> <component>.setSubmittedValue()
> 3  ActionListener method then terminates JSF lifecyle
> 4. JSF redisplays page.  Since the date component's submitted value has been
> modified, the
>    default value now appears in the date field.
> Why We are Looking for a Better Solution:
> -----------------------------------------
> We have other situations where the ActionListener method needs access to
> several fields
> on the form. These fields are currently not available to the ActionListener
> since it is
> invoked early in the JSF lifecycle.
> If the converters/validators could be disabled, the ActionListener method
> could run
> at the normal place in the JSF lifecycle.  It is understood that JSF could
> not do the data
> binding for any fields where the converter fails.  But all other fields
> would be properly
> bound and accessible to the AtionListener method.
> Thanks for your time.
> Jay

One solution may be to use the PPR (Partial Page Refresh) features in 
ADF Faces. You could set your link to be a PPR trigger and identify each 
component you need to update/refer to during that processing. ADF Faces 
will then run the full JSF life-cycle but only for those components 
involved in the PPR event.

Note that I haven't played with this much yet, but I believe that's the 
way it's meant to work :-)


View raw message