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.

2 Answers
2

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
–
ragsMay 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 OslizloMay 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.