Let's say I am at Create new user page and current url is /users/new.

When I submit this form with invalid data (e.g. mismatched passwords), user is redirected to /users.

Is it OK that user will see Create new user form but url will be /users? I think it's a problem as if user will click browser address bar and press Enter, 404 page (or whatever page mapped to GET /users) will be shown, not Create new user as user will expect.


Submitting forms with invalid data of any kind shouldn't redirect to another URL. A user is supposed to get feedback of what went wrong and correct the errors made.

But when the user enters data, it's always a good thing to instantly check wheather or not the data entered is valid or not. "Wrong postal code", "no numbers in password", "username already taken" or the like should be instantanious.

When user types, she can see wheather or not the form will pass the final validation or not. You could also disable the submit-button until the form is correct. That way you don't have to worry about what URL will be the next after submission.

  • disabling the submit-button till form is correct will lead to confusion. User will have no clue as to what else is required to be input or what is wrong in the data that is entered so far. Allowing user to submit the button and then throw the validation errors, if any, is the ideal way of handling – rags May 13 '13 at 6:54
  • Depends on the form. In case of long forms user will have to scroll all the way up to see the validation messages. I opt for disabling the button, but showing also "You need to fill in all the fields to proceed" message next to it. – Dominik Oslizlo May 13 '13 at 7:25

I have yet to see anyone in any user testing pay attention to the URL's of pages on a website or app unless they want to bookmark it, copy it, or type in a new one. In fact for most web-apps, the URL is hidden when interacting with the app, which makes it even less of an issue.

I think it is safe to say that this isn't going to be an issue. So I would suggest going with it and then only changing this if it comes up as a problem in user testing.

That said, why do you need to redirect someone from /users/new to /users when there is invalid data? Surely the simplest solution will be to show them some notification and keep them on the /users/new page? That is what has always happened on projects that I have worked on.

  • Redirecting from /users/new to /users when data is invalid is default behavior in Rails – Andrei Botalov Apr 2 '13 at 10:36
  • 1
    @AndreyBotalov I'd still love to know what the reasoning is for that in Rails. But if it's default behaviour, it has likely not proven to be a problem. – JohnGB Apr 2 '13 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.