Clearing text_field_tag -- Help PLEASE

I’m trying to clear the input fields on an Ajax form. Unfortunately,
I’ve tried this just about every way I can
think of and instead of clearing the fields, it’s clearing pretty much
the whole page. I would really appreciate some help!

The page has a form that allows the entry of two fields. The form
exists inside a

with id=entry. When the user clicks the button, a
new line is added to the page inside a
with id=ingredient_list.
The user can add as many lines as they want. I want to clear the fields
each time they click the button. What’s happening instead is that the
and everything above it on the page is getting wiped out.
The code is below. Any ideas?

Thanks in advance,

— Here’s _entry_form.rhtml —
<%= form_remote_tag(:update => ‘ingredient_list’,
:url => {:action => :add_ingredient},
:position => ‘bottom’,
:after => {:action => :clear_entry}) %>
<%= text_field_tag :name %>
<%= text_field_tag :qty %>
<%= submit_tag ‘Add Ingredient’ %>
<%= end_form_tag %>

— and here’s the clear_entry action in the controller ----
def clear_entry
render :update do |page| = ‘’
page.entry.qty.value = ‘’

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs