You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Travis Reeder <tr...@gmail.com> on 2005/11/08 23:52:32 UTC
Back button support and clicking a cancel button on a form
I'm wondering if anyone has a generic way of putting a cancel button on
forms to just go back a page?
Travis
Re: Back button support and clicking a cancel button on a form
Posted by Grant Smith <wo...@gmail.com>.
I've thought about it (does that count ?). I was thinking of using a
NavigationHandler for this as it's a rather common problem / pattern. You'd
have to store the view-id of the previous page in some session-scoped bean,
then return that from the NavigationHandler if your cancel button returns
"cancel-back"... or something.
On 11/8/05, Travis Reeder <tr...@gmail.com> wrote:
>
> I'm wondering if anyone has a generic way of putting a cancel button on
> forms to just go back a page?
>
> Travis
>
>
--
Grant Smith
Re: Back button support and clicking a cancel button on a form
Posted by Dave <ja...@yahoo.com>.
Does this belong to web flow thing?
Travis Reeder <tr...@gmail.com> wrote:inline:
On 11/8/05, Simon Kitching <sk...@obsidium.com> wrote:Travis Reeder wrote:
> I'm wondering if anyone has a generic way of putting a cancel button on
> forms to just go back a page?
>
A couple of ideas come to mind.
* You could use javascript and object document.history to effectively
"press the back button".
I don't like this because what if they cancel after a couple of invalid attempts. Also, this wouldn't work if the last page was also a form submit (which is usually the case in jsf).
* You could define a custom navigation handler that keeps track of the
necessary information. In fact, if the navigation handler stores the
actions on a stack then it could just look for a special action
string "nav:back" or similar, and if present use the top action on
the stack. Don't know what the effects on component state would be
though...
Marhias has implemented sequential state to support the back button so maybe a mix of these things could get the correct behaviour. I'll wait to hear more ideas before trying anything.
Anyway, I'm interested in whatever you find out, as this is probably
fairly closely related to providing a clickable "breadcrumb trail" which
I need to do.
Regards,
Simon
---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.
Re: Back button support and clicking a cancel button on a form
Posted by Travis Reeder <tr...@gmail.com>.
inline:
On 11/8/05, Simon Kitching <sk...@obsidium.com> wrote:
>
> Travis Reeder wrote:
> > I'm wondering if anyone has a generic way of putting a cancel button on
> > forms to just go back a page?
> >
>
> A couple of ideas come to mind.
>
> * You could use javascript and object document.history to effectively
> "press the back button".
I don't like this because what if they cancel after a couple of invalid
attempts. Also, this wouldn't work if the last page was also a form submit
(which is usually the case in jsf).
* You could define a custom navigation handler that keeps track of the
> necessary information. In fact, if the navigation handler stores the
> actions on a stack then it could just look for a special action
> string "nav:back" or similar, and if present use the top action on
> the stack. Don't know what the effects on component state would be
> though...
Marhias has implemented sequential state to support the back button so maybe
a mix of these things could get the correct behaviour. I'll wait to hear
more ideas before trying anything.
Anyway, I'm interested in whatever you find out, as this is probably
> fairly closely related to providing a clickable "breadcrumb trail" which
> I need to do.
>
> Regards,
>
> Simon
>
Re: Back button support and clicking a cancel button on a form
Posted by Simon Kitching <sk...@obsidium.com>.
Travis Reeder wrote:
> I'm wondering if anyone has a generic way of putting a cancel button on
> forms to just go back a page?
>
A couple of ideas come to mind.
* You could use javascript and object document.history to effectively
"press the back button".
* You could define a custom navigation handler that keeps track of the
necessary information. In fact, if the navigation handler stores the
actions on a stack then it could just look for a special action
string "nav:back" or similar, and if present use the top action on
the stack. Don't know what the effects on component state would be
though...
Anyway, I'm interested in whatever you find out, as this is probably
fairly closely related to providing a clickable "breadcrumb trail" which
I need to do.
Regards,
Simon