Redirect :back clears my form Data

I have a login form on the left side of a page.

The user can always log in at any time this way.

when they do I use redirect :back as an easy way to get back to the page
they were viewing before they attempted to log in.

Problem I am having is that if they make an error when logging in and I
redirect them back the username won’t show up because of the redirect.

Is there an Rails way of getting the username to show up in the form so
they can correct any typos.

The password field being empty works well in this case.

Thank you in advance.

Mitch

and I
redirect them back the username won’t show up because of the redirect.

Is there an Rails way of getting the username to show up in the form
so
they can correct any typos.

The password field being empty works well in this case.

redirect :back and the ‘back button’ aren’t the same thing. The
former is just a convenient shortcut for sending the user to another
page via an HTTP redirect.

That said, sometimes the back button doesn’t save form fields either.

Store the username in a cookie and use some javascript to prefill the
login box if that cookie exists.

-philip

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs