Form reset through rjs

I have update.rjs

if @category.errors.length > 0
page.replace_html ‘flash_box’, error_messages_for(:category)
page.show ‘flash_box’
else
page.hide ‘flash_box’
page.replace_html @category.dom_id, :partial => “category”, :locals => {
:category => @category}
page.visual_effect :highlight, @category.dom_id, :startcolor =>
“’#fff000’”
page.replace_html ‘form_add_new’, :partial => “index”
page[“category_form”].reset
end

So basicly i am updating a div with edited category(works), then I try
to replace the form from edit form to add new category form(works) but i
cannot clear
this form, it still has values from my edit form even though i am making
a .reset.

This method works on my create.rjs
i dont have errors in firebug.

Pawel

page[“category_form”].reset

You may try something like :

page[‘new_category’].down(‘form’).reset

HTH

Alain R.

http://blog.ravet.com