I'm not sure how t:saveState would work in this scenario?:

1. The first time a form is brought up, the fields are empty (value bindings
on form field are to properties on a backing bean initially set to "")
2. next, the user inputs data that fails validation; 
3. since the model is never updated, any fields where the user had entered
data are cleared on the post-back because the model was not updated due to
the failed validations. Therefore, all data the user entered is lost.
t:saveState does not help since the properties on the backing bean were
never updated.

This behavior does not occur in the sample applications - for example, using
validate.jsp, if I enter bad data in the form, the values in the form field
are not cleared when the validations fail.  Validate.jsp does not use
t:saveState;  I can't see though what I am missing?

Potentially, could this be related to another warning I am receiving related
to the renderer - see below (not sure how to fix this one either)?

Thanks for any help.

Jan 27, 2006 10:29:42 PM org.apache.myfaces.renderkit.html.HtmlRenderKitImpl
getRenderer
WARNING: Unsupported component-family/renderer-type:
javax.faces.ViewRoot/javax.faces.Text
Jan 27, 2006 10:29:42 PM org.apache.catalina.core.ApplicationContext log
INFO: No Renderer found for component {Component-Path : [Class:
javax.faces.component.UIViewRoot,ViewId: /enrollisp.jsp]}
(component-family=javax.faces.ViewRoot, renderer-type=javax.faces.Text)
Jan 27, 2006 10:29:42 PM javax.faces.component.UIComponentBase getRenderer
WARNING: No Renderer found for component {Component-Path : [Class:
javax.faces.component.UIViewRoot,ViewId: /enrollisp.jsp]}
(component-family=javax.faces.ViewRoot, renderer-type=javax.faces.Text)
Jan 27, 2006 10:29:42 PM org.apache.myfaces.renderkit.html.HtmlRenderKitImpl
getRenderer
WARNING: Unsupported component-family/renderer-type:
javax.faces.ViewRoot/javax.faces.Text
Jan 27, 2006 10:29:42 PM org.apache.catalina.core.ApplicationContext log
INFO: No Renderer found for component {Component-Path : [Class:
javax.faces.component.UIViewRoot,ViewId: /enrollisp.jsp]}
(component-family=javax.faces.ViewRoot, renderer-type=javax.faces.Text)
Jan 27, 2006 10:29:42 PM javax.faces.component.UIComponentBase getRenderer


-----Original Message-----
From: Dennis Byrne [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 27, 2006 12:38 AM
To: MyFaces Discussion
Subject: Re: form fields clearing on validation errors

You are correct.  To maintain those values, try using the t:saveState tag,
where the value attribute is set to the model value you wish to preserve
across each request.  I'm pretty sure there is a wiki article on this.
These model values are in request scope, right ?

Dennis Byrne

>-----Original Message-----
>From: Tom Butler [mailto:[EMAIL PROTECTED]
>Sent: Friday, January 27, 2006 12:28 AM
>To: ''MyFaces Discussion''
>Subject: RE: form fields clearing on validation errors
>
>Ps I see that validation steps occur before the update model values (assume
>update model values invokes setters to updated properties in the backing
>bean), so if a validation error occurs, the model (backing bean) is not
>updated.  Based on this, I assume on the post-back that the form in the
.jsf
>form calls the getters in the backing bean which return null values (values
>not yet set.)  Is this interpretation correct?  If so, what techniques can
I
>use to maintain the data inputted by the user without have the form fields
>clearing?
>
> 
>
>JSF lifecycle diagram of conversion and validation phases
>
> 
>
> 
>
>  _____  
>
>From: Tom Butler [mailto:[EMAIL PROTECTED] 
>Sent: Thursday, January 26, 2006 11:25 PM
>To: 'MyFaces Discussion'
>Subject: form fields clearing on validation errors
>
> 
>
>I am using validators within my form - when a validation error occurs, all
>the form fields are cleared when the validation error messages are
>displayed?  If there are not validation errors, everything is passed to the
>bean correctly.  The issue only occurs when there is a validation error and
>the original form is re-rendered with all the previously inputted fields
>cleared (want fields to remain intact so user can correct)?  This is my
>first validator, however, I must be missing something obvious?
>
> 
>
>Example validators:
>
> 
>
><h:inputText id="lastname" value="#{enrollispbean.lastname}"
>required="true">
>
> 
>
>and, 
>
> 
>
><h:inputText id="email1" value="#{enrollispbean.email1}" required="true">

>
><t:validateEmail /> 
>
></h:inputText>
>
> 
>
>enrollispbean is a managed bean:
>
> 
>
><managed-bean> 
>
><managed-bean-name>enrollispbean</managed-bean-name>
>
><managed-bean-class>com.domain.EnrollIspBean</managed-bean-class> 
>
><managed-bean-scope>request</managed-bean-scope> 
>
></managed-bean>
>
> 
>
> 
>
>


Reply via email to