# Howto keep already entered form fields

**URL:** <https://www.ruby-forum.com/t/howto-keep-already-entered-form-fields/73429>\
**Category:** Rails\
**Created:** [February 26, 2006, 11:11am UTC](https://www.ruby-forum.com/t/howto-keep-already-entered-form-fields/73429 "2006-02-26T11:11:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![snowman1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b487fb/32.png) [@snowman1](https://www.ruby-forum.com/u/snowman1)\
**Post date:** [February 26, 2006, 11:11am UTC](https://www.ruby-forum.com/t/howto-keep-already-entered-form-fields/73429/1 "2006-02-26T11:11:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![snowman1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b487fb/32.png) [@snowman1](https://www.ruby-forum.com/u/snowman1)\
**Post date:** [February 26, 2006, 11:40am UTC](https://www.ruby-forum.com/t/howto-keep-already-entered-form-fields/73429/2 "2006-02-26T11:40:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![snowman1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b487fb/32.png) [@snowman1](https://www.ruby-forum.com/u/snowman1)\
**Post date:** [February 26, 2006, 12:16pm UTC](https://www.ruby-forum.com/t/howto-keep-already-entered-form-fields/73429/3 "2006-02-26T12:16:05Z")

</div>

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!
