How would I reset the controls on a form? I have a few text fields and
selection lists, and I want them cleared (text fields) or restored to
the top value (the :prompt in the select). I tried the code below with
render :update.

the form is in the view:

<% form_for :item, :html => { :id => 'items_form' } do |f| %>
 <%= f.text_field :name %>
 <%= f.select :available,
     [['YES','true'],['NO','false']],
     :prompt => '--Available?--' %>

<%= link_to_remote 'reset',
     :update => 'items_list',
     :url => { :action => 'reset_form' } %>

<% end %>

the action is in the controller:

def reset_form
  render :update => do |page|
    page['items_form'].reset # this, um, doesn't work
  end
end

I'm new in rails, so any help will be great.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to