Clearing form fields for a popup


#1

I am using prototype to create modal popups for my login and register
pages, but the fields are populating with the data from certain
variables. For example, I have a show page that finds a user like
so:

@user = User.find(params[:id])

and my form uses:
<% form_for :user, :url => users_path do |f| -%>

so it is populating the form with the data from @user. Should I
rename the @user variable, or is there a way to avoid the populating
of the form?

Thanks for any help.


#2

Hi David,

David wrote:

so it is populating the form with the data from @user. Should I
rename the @user variable, or is there a way to avoid the populating
of the form?

You should be doing the find in the controller and calling the new
method to
return a new, empty object or the edit method to return an existing
object.

HTH,
Bill