chintanparikh
chintanparikh

Reputation: 1682

Can I make the browser back button go to the edit page instead of new on creation

Here's the situation.

  1. A user goes to the #new action, clicks submit form, and the object is created. The user is shown the show page
  2. The user realizes something is wrong, so they click back (even though there's clearly an edit button there)
  3. The user fixes whatever needs fixing and clicks submit again, thus creating a new object

What I want to do is have the user directed to the edit action when they click back on the show page. It's also got to be IE 7+ compliant. Is this possible?

Another alternative I was considering was creating a random string on a hidden field on the #new page, and using that to check whether the object's already been created.

Thoughts?

Upvotes: 0

Views: 100

Answers (1)

slinky2000
slinky2000

Reputation: 2673

I would use in javascript

document.referrer

on the new page to see where the user came from and if it's the created page, you can then do whatever is necessary to go to the edit view.

Upvotes: 1

Related Questions