You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Angie Lin <al...@tivo.com> on 2002/09/26 19:35:18 UTC

cancel and session-scope form

Hi there,

How can I prevent a cancel button from populating the form bean? 
Normally this isn't a problem, except that my form bean is in 
session-scope (for an wizard-like implementation).

I've considered reconfiguring it so that the form stays in request-scope 
for each page in the wizard.  I would then instantiate the form in 
session-scope myself and manage the copying of form fields from each 
page manually depending on if the user submitted or cancelled.  But I 
was hoping for a simpler solution.

thanks,
Angie


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Help Re: cancel and session-scope form

Posted by Angie Lin <al...@tivo.com>.
Thanks for the tip, but I'm trying to avoid javascript as much as 
possible.  It looks like I'll have to go ahead and manage my session 
form manually, and use a request-scoped form so that the auto-population 
doesn't blow away the properties.  

Thanks again,
Angie

Eddie Bush wrote:

> Actually ... I've never done this before, but ...
>
> Why couldn't you invoke a javascript method on your Cancel button that 
> invoked the forms reset method?  That might be the easiest solution ...
>
> Eddie Bush wrote:
>
>> Just quickly thinking it over ...
>>
>> When your form submits, you're going to hit an action.  Your action 
>> is going to look and see what the user told you they wanted to do and 
>> act appropriately.  Now, that doesn't help you keep the form from 
>> being populated, but you can certainly keep from updating your 
>> persistent storage using this information - and know that, instead, 
>> you should request fresh data to repopulate the form with.  I like to 
>> rename my buttons to something like "action" or "userAction" - and 
>> give all of them the same name - so I can judge off the value of that 
>> parameter what the user is telling me they'd like to have happen.
>>
>> That's my "spontaneous, first-cut" answer.  I can't think of a way to 
>> circumvent the population ... 
>
>
>

-- 
Angie Lin
alin@tivo.com
408.519.9250



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Help Re: cancel and session-scope form

Posted by Eddie Bush <ek...@swbell.net>.
Actually ... I've never done this before, but ...

Why couldn't you invoke a javascript method on your Cancel button that 
invoked the forms reset method?  That might be the easiest solution ...

Eddie Bush wrote:

> Just quickly thinking it over ...
>
> When your form submits, you're going to hit an action.  Your action is 
> going to look and see what the user told you they wanted to do and act 
> appropriately.  Now, that doesn't help you keep the form from being 
> populated, but you can certainly keep from updating your persistent 
> storage using this information - and know that, instead, you should 
> request fresh data to repopulate the form with.  I like to rename my 
> buttons to something like "action" or "userAction" - and give all of 
> them the same name - so I can judge off the value of that parameter 
> what the user is telling me they'd like to have happen.
>
> That's my "spontaneous, first-cut" answer.  I can't think of a way to 
> circumvent the population ... 


-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Help Re: cancel and session-scope form

Posted by Eddie Bush <ek...@swbell.net>.
Just quickly thinking it over ...

When your form submits, you're going to hit an action.  Your action is 
going to look and see what the user told you they wanted to do and act 
appropriately.  Now, that doesn't help you keep the form from being 
populated, but you can certainly keep from updating your persistent 
storage using this information - and know that, instead, you should 
request fresh data to repopulate the form with.  I like to rename my 
buttons to something like "action" or "userAction" - and give all of 
them the same name - so I can judge off the value of that parameter what 
the user is telling me they'd like to have happen.

That's my "spontaneous, first-cut" answer.  I can't think of a way to 
circumvent the population ...

Angie Lin wrote:

> Any ideas are appreciated.
>
> Is there anyway to keep my session-scoped form from being populated by 
> a click of an <html:cancel> button?  Is there any hook in the 
> underlying Action that I can intercept prior to the ActionForm 
> auto-population?
>
> Thanks,
> Angie 


-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Help Re: cancel and session-scope form

Posted by Angie Lin <al...@tivo.com>.
Any ideas are appreciated.

Is there anyway to keep my session-scoped form from being populated by a 
click of an <html:cancel> button?  Is there any hook in the underlying 
Action that I can intercept prior to the ActionForm auto-population?

Thanks,
Angie


Angie Lin wrote:

> Hi there,
>
> How can I prevent a cancel button from populating the form bean? 
> Normally this isn't a problem, except that my form bean is in 
> session-scope (for an wizard-like implementation).
>
> I've considered reconfiguring it so that the form stays in 
> request-scope for each page in the wizard.  I would then instantiate 
> the form in session-scope myself and manage the copying of form fields 
> from each page manually depending on if the user submitted or 
> cancelled.  But I was hoping for a simpler solution.
>
> thanks,
> Angie
>
>
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>


-- 
Angie Lin
alin@tivo.com
408.519.9250



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>