Best Practices For back/cancel/return button

Are there any best practices for implementing a back/cancel/return
button… even when the page you want to return people too is 2 pages
back (when people submit form and then want to return)?

Thanks :slight_smile:

Your Friend,

John K.
http://www.kopanas.com

=====================================================================
http://www.soen.info - source of the freshest software engineering
information on the net
http://cusec.soen.info - software engineering conference

Hey John ! I just use the session[], and keep track of the pages…
etc.
I think that is about the best way to do it as far as I know. Just did
this
this morning :slight_smile:

What variable do you use to get the page?

On 14-Feb-06, at 7:05 PM, Dylan S. wrote:

information on the net
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

John K.
http://www.kopanas.com

=====================================================================
http://www.soen.info - source of the freshest software engineering
information on the net
http://cusec.soen.info - software engineering conference

none. when im on the first page of the form, i set something new in the
session, like: session[:user_reg_first], with an arbitrary value. when
they get to the second page, i do the same but with
session[:user_reg_second]…etc…etc.
if someone is on the first page, and tries to go to the third, i make
sure
they have a valid entry in session[:user_reg_third], if they don’t, I
check
session[:user_reg_second]…etc

i think you get the idea. it’s a verbose method… but it works for me
:slight_smile:

Wow… that is crazy :-).

For now I am going with:
<%= link_to “return without loging-in”, “javascript:history.back()” %>

Unless someone has better suggestions :-).

On 14-Feb-06, at 7:34 PM, Dylan S. wrote:

did this this morning :slight_smile:
Your Friend,


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

John K.
http://www.kopanas.com

=====================================================================
http://www.soen.info - source of the freshest software engineering
information on the net
http://cusec.soen.info - software engineering conference

On 14-Feb-06, at 7:41 PM, John K. wrote:

For now I am going with:
<%= link_to “return without loging-in”, “javascript:history.back()” %>

Unless someone has better suggestions :-).

you can also try:
<%= link_to ‘back’, request.env[‘HTTP_REFERER’] %>

/Jeff


http://quotedprintable.com

Ahh… true. Well put Ben, thanks :slight_smile:
John, my explanation was indeed for a wizardy/multi-step form process.

I think you two were misunderstanding each other… Dylan was talking
about controlling
which page in a sequence of pages a user can go to (a “wizard”), whereas
John just wants
to create a back-button link.

N’est pas?

b

PS: John, why not just make the “back” link go the url it should? You
solution won’t work
if javascript’s not enabled (though we’re basically turning into a
javascript or nothing
world).

Hello,

On Tue, Feb 14, 2006 at 06:49:37PM -0500, John K. wrote:

Are there any best practices for implementing a back/cancel/return
button… even when the page you want to return people too is 2 pages
back (when people submit form and then want to return)?

I use this code when I know I will have to redirect a user back:

def store_location
session[:return_to] = request.request_uri
end

def redirect_back
redirect_to(session[:return_to])
end

You could use session[:return_to] to create a back link.

Hope this helps!

See you


Damien MERENNE [email protected]
http://www.cosinux.org/blogs/dam/

Chuck Norris doesnt shave; he kicks himself in the face.
The only thing that can cut Chuck Norris is Chuck Norris.