I have a form below a table to add new notes to an item. If the note
does not have a title or body, the note is not saved and a form error
is displayed. However, if the note validates successfully, then the
note is added to the bottom of the table above. Just for reference,
the table id is “note_list” and the add form div is id=“note_add_form”.
So, my problem/question is. Upon success, I want to update note_list
appending to the bottom of the table, however, upon failure, I want
to replace note_list not append to the bottom of it.
I can do something like this:
:update => { :success => ‘note_list’, :failure =>
‘note_add_form’}, :position => :bottom
on my form tag and that works partially. When a note is added
successfully, it’s appended to the bottom of the table. However, when
a validation error occurs, the error message and a whole new form is
appended to the bottom of the existing form. If I fail again, the
note_add_form div will then have three forms, etc…
Is there a way to make this work?
Jeremy C.