You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Dennis Byrne <de...@dbyrne.net> on 2006/02/02 02:29:56 UTC

Re: Any way to disable/sidestep converters/validators while processing a ActionListener event?

Please send these questions to the user list, not the dev list.  Thank you.

Dennis Byrne

>-----Original Message-----
>From: Senior Consultants Inc. [mailto:seniorconsultantsinc@gmail.com]
>Sent: Wednesday, February 1, 2006 08:22 PM
>To: users@myfaces.apache.org, dev@myfaces.apache.org
>Subject: Any way to disable/sidestep converters/validators while processing a ActionListener event?
>
>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
>