Trinidad has a <tr:resetActionListener> tag that automates this.

http://incubator.apache.org/adffaces/trinidad-api/tagdoc/tr_resetActionListener.html

-- Adam


On 3/22/07, Jochen Traunecker <[EMAIL PROTECTED]> wrote:

Thx - UIXeditablevalue.resetValue() does the job!

Just for curiosity:I can't rely on changing the backing-bean BEFORE
RENDER_RESPONSE to have all UIComponents (Tables, Trees, Checkboxes, ...)
display the latest state of the backing bean when invoking some action with
immediate=true; I also have to invoke some reset methods on all components?



----- Ursprüngliche Mail ----
Von: Matthias Wessendorf <[EMAIL PROTECTED]>
An: [email protected]
Gesendet: Donnerstag, den 22. März 2007, 11:10:36 Uhr
Betreff: Re: [TRINIDAD] How to reset a form

have you also tried to call resetValue() on UIXeditablevalue?

-M

On 3/22/07, Jochen Traunecker <[EMAIL PROTECTED]> wrote:
> 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
>


--
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com






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

Reply via email to