incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Traunecker <madnec...@yahoo.com>
Subject [TRINIDAD] How to reset a form
Date Thu, 22 Mar 2007 09:53:13 GMT
Hello everybody,

using Trinidad and Shale I ran into this silly simple problem: I want a form containing a
bunch of text-input fields, each of them with some validator associated to get reset by clicking
a commandButton. To avoid validating the input fields I use immediate="true" for the reset
button. My model gets reset (see pseudocode) but the textfields in the browser don't disply
the model-values - they keep their values. I'm wondering, how to reset some UIComponents (without
any validation). I thougth, that all updates to the datamodel/backingbean before RENDER_RESPONSE
will have an impact on the rendered output, regardless of immediate="true". Is this a partialPageRendering
issue ?


Thanks for your help! 
Jochen

Pseudocode


<tr:form>
    <tr:panelPage>
        <tr:panelHorizontalLayout ...>
            <tr:treeTable>...</tr:treeTable>
          <tr:switcher facetName="...">
               <tr:facet name="a"> ...</tr:facet>
                <tr:facet name="b">
                   <tr:panelFormLayout>
                        <tr:inputText id="name"> <f:validateLength .../></inputText>
                        <tr:inputText id="street"> <f:validateLength .../></inputText>
                        <tr:commandButton text="save" action="#{backingbean.save}"/>
                        <tr:commandButton text="reset" action="#{backingbean.reset}" immediate="true"/>
                </tr:panelFormLayout>
                </tr:facet>
           </tr:switcher>
        </tr:panelHorizontalLayout>
   </tr:panelPage>
</tr:form>



backingbean.class

String name="Foo";

public String save(){
    //getName is set to validated name provided by the user
    someDao.persist(getName());
}

public String reset(){
    //do nothing, as prerender will reset the model
}
...
public void prerender(){
   name=someDao.retrieve(); //allways reset datamodel to latest persistent state
}

public String getName(){
    return name;
}

public void setName(String name){
    this.name= name;
}




		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

Mime
View raw message