[ 
https://issues.apache.org/jira/browse/MYFACES-1714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12529888
 ] 

Martin Marinschek commented on MYFACES-1714:
--------------------------------------------

Hi Michael,

I wonder if this is what you're looking for:

In JSF 1.2, you can call 

((EditableValueHolder)uiComp).refresh();

on all components implementing the EditableValueHolder-interface (basically all 
input-components). You'll need to do this (best would be binding a component 
higher up in the hierarchy into your backing-bean, and then recursively call 
this method) to clean out existing component values. Put another way: how 
should JSF know that the input values of your components are not relevant 
anymore, and need to be replaced with the backing bean values, if you don't 
tell the framework explicitly?

In JSF 1.1, the call is more complicated:


EditableValueHolder evh = (EditableValueHolder)uiComp;
evh.setSubmittedValue(null);
evh.setValue(null);
evh.setLocalValueSet(false);

regards,

Martin

> submitted (or local) values are not erasable after conversion or validation 
> error
> ---------------------------------------------------------------------------------
>
>                 Key: MYFACES-1714
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1714
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.1.5
>         Environment: tomcat 5.5.23
> myfaces 1.1.5
> tomahawk 1.1.5
> ajax4jsf 1.1.1
>            Reporter: Michael Heinen
>            Priority: Critical
>         Attachments: validation.war
>
>
> There is a serious conversion/validation problem with JSF in combination with 
> ajax..
> From my point of view this is a major show stopper for jsf applications in 
> combination with ajax.
> Therefore I created a simple demo application and attach it to this issue.
> My form contains a few input fields for Strings, dates and a number. If an 
> invalid format is entered then the submitted value is not erased and the page 
> is rerendered with the entered value.
> This is working fine so far.
>  
> The error occurs now if I click then another ajax command that forces a 
> refresh of the invalid fields via ajax.
> I use an a4j:commandButton with ajaxSingle=true and surrounded this button by 
> an a4j:region in order to process no input fields on serverside.
> The values that are bound via valueBinding to the inputFields are set to null 
> or reinitialized in the invoked ActionListener.
> But the old invalid data from the previous request is rerendered on the page.
>  
> This happens because the submitted values of the invalid inputFields are not 
> null but still contain the old invalid data.
> Therefore the valueBinding is not evaluated in the getter.
>  
> I can't set the submitted value to null in the converter because invalid 
> values should be rerendered in case that a normal processing button (not 
> cancel button) is clicked.
> Pls have a look at the demo application:
> Call ... faces/test.jsp
> 1) Enter some data
>    (e.g name="twotest", startDate="01/01/70", endDate="01/01/70" 
> message="hello" count=55)
>    and click save
>    Result: Everything works fine.The new object is rendered in the list
> 2) Enter invalid data
>    (e.g. number=doh)
>    and click save
>    Result: conversion error "Count:": value is no valid number (don't know 
> the correct english message)
> 3) Click create new
>    Result: Field count does still contain the old value doh
>    
> 4) Click Edit
>    Result: Field count does still contain the old value doh
>    The other fields are correctly initialized
>    
> My first approach was to except submittedValue from stateSaving but this did 
> not solve the problem..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to