Forum: Ruby on Rails Best practices: form fails, now what...

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Faisal N Jawdat (Guest)
on 2007-03-03 10:36
(Received via mailing list)
Situation:  A user submits a form.  The inputs are in some way
invalid.  You present the original form.

Question:  How do you present the original form as the user had it
filled out (so they can correct it) rather than in its original state
(requiring them to re-enter everything).

I have more or less hackish ways of doing this, but wondered how
other people were doing it.

on 2007-03-03 13:09
(Received via mailing list)
It's easiest if you post back to the same action that the form is in.
Just make sure you set all the class variables. eg:

def login
@user = params[:user] ||
#login, redirect
This topic is locked and can not be replied to.