Forum: Ruby on Rails howto keep already entered form fields

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ijd I. (Guest)
on 2006-02-26 12:11
Hi,

is there a way to keep the already entered form fields when the form is
re-displayed after some error has been detected and reported to the user
via flash?

Regards
IJD
Curtis Spencer (Guest)
on 2006-02-26 12:40
(Received via mailing list)
IJD,

Try using <%= text_field "object_name","field_name" %> rather than
typing the html for the form input fields.  If the object is in the
request, than it will be filled in properly if that field has a value.
In your controller just make you sure you have a instance variable
called @object_name.

Make a scaffold to see more examples of this.

-Curtis
Ijd I. (Guest)
on 2006-02-26 13:16
Curtis Spencer wrote:
> IJD,
>
> Try using <%= text_field "object_name","field_name" %> rather than
> typing the html for the form input fields.  If the object is in the
> request, than it will be filled in properly if that field has a value.
> In your controller just make you sure you have a instance variable
> called @object_name.
>
> Make a scaffold to see more examples of this.
>
> -Curtis

thx!
This topic is locked and can not be replied to.