How to redisplay form contents

It sounds like you're using the form_tag helpers (e.g. text_field_tag) rather than the form helpers (e.g. text_field). The form helpers hook into ActiveRecord objects and help you do this kind of redisplay easily, but with the form_tag helpers you need to specify the values manually.

For instance, if I have a text field like this:

text_field_tag("name")

then it will always render as empty when you reload the page, because I'm not telling it what value to display.

However, if my controller picks up the data like this:

@name = params[:name]

then I can change the text field tag to this:

text_field_tag("name", @name)

and it will use the contents of @name as the default value of the text field when the page is loaded.

Chris