Retain Form Values on reset

Ashwin,

I had to do something similar in my app. What you can do is create an object that mimics ActiveRecord in your controller. By that, I mean the object should have methods with the same names as the attributes which return the attribute's value. Then pass that to a form helper, and you should be golden.

Controller action:    @user = User.new(params[:user]) # User is a class you'll have to write

View template: <% form_for :user, @user, :url => {:action => 'create'} do |f| %>   <%= f.text_field :username %>    ....   <%= f.submit %> <% end %>

The trick is that `f.text_field :username` will create a text field and set its value to what is returned by calling `@user.username`. You can read up more on form helpers here:

I hope that helps,

~David