myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Alexander \(KBSA 21\)" <alexander.je...@credit-suisse.com>
Subject RE: Any way to disable/sidestep converters/validators while processing a ActionListener event?
Date Thu, 02 Feb 2006 07:29:25 GMT
sorry was distracted and have not checked the receipient...
 

> -----Original Message-----
> From: Jesse Alexander (KBSA 21) 
> Sent: Thursday, February 02, 2006 8:24 AM
> To: MyFaces Development
> Subject: RE: 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.
> 
> A well known usecase...
> 
> 	
> 	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.
> 
> What we found is that some fields would not show the values 
> the user had
> entered before...
> 
> 	
> 	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.
> 
> You might have a look at the OptionalValidators described here:
> <http://wiki.apache.org/myfaces/OptionalValidationFramework>
> 
> Comments, testcases and problem-reports are welcome.
> 
> regards
> Alexander
> 	 
> 	 
> 	Thanks for your time.
> 	 
> 	Jay
> 
> 

Mime
View raw message