Hi,
I was the one who started this thread, glad to see that it gets more attention.
Consider the following case;
<h:form>
<h:inputText value="#{person.firstname}" required="true"/>
<h:inputText value="#person.surname}" required="true"/>
<h:commandButton value="Save">
<f:ajax render="@form" execute="@form"/>
</h:commandButton>
<h:commandButton value="Reset" actionListener="#{pprBean.reset}">
<f:ajax render="@form" execute="@this"/>
</h:commandButton>
<h:outputText value="#{person.firstname}" id="display" />
</h:form>
And the bean;
public class Bean {
private String firstname;
private String surname;
...
public void reset() {
firstname = null;
surname = null;
}
}
So there are two inputs bound to two properties and two buttons one to save one to reset.
- Enter a value for the first input, leave the second one blank.
- Click save button and validation will fail.
- Click reset button and although reset action is invoked first input still uses old value since it saves the local value in state and uses that instead of bean property value when rendering.
Setting immediate to true on reset button can't help here since input text will render submittedValue in that case instead of local value so still not the bean property.
One quick solution I can think of is not saving the value in state but there might be side effect I'm not aware of, probably if input is in UIData as UIData has special treatment to save/restore descendants.
There are also alternatives at;
> http://wiki.apache.org/myfaces/ClearInputComponents
But I think they're a bit complicated, one should not have trouble in clearing a form.
Regards,
Çağatay Çivici
Principal Consultant
PrimeFaces Lead | JSF EG Member
Prime Teknoloji
Bilkent Cyberpark, A-303d
06800 Ankara/Turkey
Tel: +90 312 265 05 07
http://www.prime.com.tr
On Aug 8, 2011, at 10:57 PM, Leonardo Uribe wrote:
> Hi
>
> Doing some documentation improvements I notice this wiki page:
>
> http://wiki.apache.org/myfaces/ClearInputComponents
>
> It is a very old page, but I think it describes in some way what's
> missing. Other useful page is here:
>
> https://cwiki.apache.org/confluence/display/MYFACES/How+the+immediate+attribute+works
>
> I'll try to submit a proposal about it this week.
>
> regards,
>
> Leonardo Uribe
>
> 2011/8/8 <edward.burns_at_oracle.com>:
>> Where does this thread stand?
>>
>> Alexander asserted that our existing immediate="true" feature was
>> sufficient but Andy indicated there was another case for which an
>> additional feature might be necessary?
>>
>> Because this issue was not in JSF_2_2_WORKING_SET, I'll need a detailed
>> proposal in order to entertain including it at all. So far, I haven't
>> seen enough detail.
>>
>> If there is no reply in a week, I'd like to close this issue out.
>>
>> Thanks,
>>
>> Ed
>>