You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Lindholm, Greg" <gl...@neom.com> on 2006/04/04 20:53:11 UTC

How to implement a Start Again Button on a edit view

I have an edit view that let's the user modify an object thru a number
of steps.
All the "steps" redisplay the same view with additional/changed
information.
Once all the information has been entered there is a Save button to make
the
changes permanent.

I want to have a "Start Again" button that the user can press at anytime
to 
discard all the changes and start again in the same view.

<h:commandButton immediate="true" action="#{bb.startAgain}" value="Start
Again" />

In the startAgain() action I reset all the backing beans properties from

the saved original object. The problem is the view components still have

the last values displayed.
(I've tried both an Action and ActionListener and get the same result.)

The form that gets redisplayed to the user has the last values displayed

NOT my backing bean property values.

Is this because the "Update Model Values" phase was skipped?

Is there a way to reset the view so it acts like this is the first time.

I want the view components to get all there values from the bound
backing 
bean properties like they normally would following a non immediate
action event.

Can anyone help?

Using MyFaces and Tomahawk 1.1.1.


Re: How to implement a Start Again Button on a edit view

Posted by Mike Kienenberger <mk...@gmail.com>.
On 4/4/06, Mario Ivankovits <ma...@ops.co.at> wrote:
> I am not sure proposing <redirect/> for this is the best idea.
>
> Once we have a technology in place which will survive request
> information this wont work any more - given the user configures the new
> classes.

That's a good point.   It does now make me wonder if the spec defines
any particular behavior in this regard for <redirect\>.   We might
need to make the behavior configurable.

Re: How to implement a Start Again Button on a edit view

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> You could probably create a second navigation rule which includes
> <redirect/> and activate it after your've updated your view.
>   
I am not sure proposing <redirect/> for this is the best idea.

Once we have a technology in place which will survive request
information this wont work any more - given the user configures the new
classes.


Might it help to put the commandButton into the new s:subForm tag?
That way you dont have to use the immediate=true.

Just a thought, dont know if it works.

Ciao,
Mario


Re: How to implement a Start Again Button on a edit view

Posted by Mike Kienenberger <mk...@gmail.com>.
You could probably create a second navigation rule which includes
<redirect/> and activate it after your've updated your view.

That should start the page out as if you were going to it again for
the first time, provided you've reset everything stored in session and
application scope.


On 4/4/06, Lindholm, Greg <gl...@neom.com> wrote:
> I have an edit view that let's the user modify an object thru a number
> of steps.
> All the "steps" redisplay the same view with additional/changed
> information.
> Once all the information has been entered there is a Save button to make
> the
> changes permanent.
>
> I want to have a "Start Again" button that the user can press at anytime
> to
> discard all the changes and start again in the same view.
>
> <h:commandButton immediate="true" action="#{bb.startAgain}" value="Start
> Again" />
>
> In the startAgain() action I reset all the backing beans properties from
>
> the saved original object. The problem is the view components still have
>
> the last values displayed.
> (I've tried both an Action and ActionListener and get the same result.)
>
> The form that gets redisplayed to the user has the last values displayed
>
> NOT my backing bean property values.
>
> Is this because the "Update Model Values" phase was skipped?
>
> Is there a way to reset the view so it acts like this is the first time.
>
> I want the view components to get all there values from the bound
> backing
> bean properties like they normally would following a non immediate
> action event.
>
> Can anyone help?
>
> Using MyFaces and Tomahawk 1.1.1.
>
>