You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jon Williams <wi...@gmail.com> on 2014/04/11 19:24:21 UTC

How to reset a form enclosed in a zone from the java-side handler?

I have a form enclosed in a zone. When I submit the form with my register
button, it's being handled by method:
private Object onSelectedFromRegister() {
...
   return zone;
}

The default behaviour seems to be that when the zone gets re-rendered the
UI form fields retain their submitted post values client side.
What I'd like to be able to do is, in my register handler (see above), i'd
like to null out all of the form fields next time the zone re-rerenders.

In my form I have a text field component that's bound to a page property
that has no persistence. So it's just like a regular instance variable in
my page class. How can I (javaside) reset the form (or just the textfield)
w/o writing javascript? I've tried injecting the form and the textfield
components, but found no useful methods there. And nulling out the instance
variable does nothing in this regard either.

any suggestions/ clues much appreciated.
thanks

Re: How to reset a form enclosed in a zone from the java-side handler?

Posted by Jon Williams <wi...@gmail.com>.
Thanks Geoff . Worked like a charm.


On Fri, Apr 11, 2014 at 11:00 PM, Geoff Callender <
geoff.callender.jumpstart@gmail.com> wrote:

> I'd recommend using Form's normal events. See:
>
>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/whatiscalledandwhen
>
> or for T5.4:
>
>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/whatiscalledandwhen
>
> Instead of returning the zone from onSelected, return it from onSuccess
> and, if errors are possible, onFailure. Then in onPrepareForRender set the
> form values to whatever defaults you want.
>
> Geoff
>
> On 12/04/2014, at 3:24 AM, Jon Williams wrote:
>
> > I have a form enclosed in a zone. When I submit the form with my register
> > button, it's being handled by method:
> > private Object onSelectedFromRegister() {
> > ...
> >   return zone;
> > }
> >
> > The default behaviour seems to be that when the zone gets re-rendered the
> > UI form fields retain their submitted post values client side.
> > What I'd like to be able to do is, in my register handler (see above),
> i'd
> > like to null out all of the form fields next time the zone re-rerenders.
> >
> > In my form I have a text field component that's bound to a page property
> > that has no persistence. So it's just like a regular instance variable in
> > my page class. How can I (javaside) reset the form (or just the
> textfield)
> > w/o writing javascript? I've tried injecting the form and the textfield
> > components, but found no useful methods there. And nulling out the
> instance
> > variable does nothing in this regard either.
> >
> > any suggestions/ clues much appreciated.
> > thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: How to reset a form enclosed in a zone from the java-side handler?

Posted by Geoff Callender <ge...@gmail.com>.
I'd recommend using Form's normal events. See:

	http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/whatiscalledandwhen

or for T5.4:

	http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/whatiscalledandwhen

Instead of returning the zone from onSelected, return it from onSuccess and, if errors are possible, onFailure. Then in onPrepareForRender set the form values to whatever defaults you want.

Geoff

On 12/04/2014, at 3:24 AM, Jon Williams wrote:

> I have a form enclosed in a zone. When I submit the form with my register
> button, it's being handled by method:
> private Object onSelectedFromRegister() {
> ...
>   return zone;
> }
> 
> The default behaviour seems to be that when the zone gets re-rendered the
> UI form fields retain their submitted post values client side.
> What I'd like to be able to do is, in my register handler (see above), i'd
> like to null out all of the form fields next time the zone re-rerenders.
> 
> In my form I have a text field component that's bound to a page property
> that has no persistence. So it's just like a regular instance variable in
> my page class. How can I (javaside) reset the form (or just the textfield)
> w/o writing javascript? I've tried injecting the form and the textfield
> components, but found no useful methods there. And nulling out the instance
> variable does nothing in this regard either.
> 
> any suggestions/ clues much appreciated.
> thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org