Topic: Ajax submission inside a form?

I have created a form using drag and drop effects that allows the user to drag people from a list of names into an authors area and then sort them into the appropriate order. This is in the context of a larger form that holds information about a publication.

Now I need to create a way to allow the user to add a person to the list of people that isn't in the list. So basically I would like to submit a value from a text field via Ajax and update the list of people in place.

I have the method and rjs written, but I can't figure out how to make the Ajax call from within the form field. Nested forms are illegal and in any case don't seem to work (it ignores the second form tag defining the remote form.

Any ideas on how to accomplish this?

Re: Ajax submission inside a form?

Ok, I am thinking that I might be able to use observe_field to accomplish this - though I am not very familiar with it...

I have this code so far:

<%= text_field :new_ndu, :name %>
<div id='add_new_ndu'><%= button_to 'Add Ndu' %></div>   
<%= observe_field 'add_new_ndu', :on => 'click', :url => {:action => 'add_ndu'} %>

I need a way to pass the value of the text_field though.

The documentation for observe_field says I can use a :with parameter (see below) - could I pass the value somehow with this?

A JavaScript expression specifying the parameters for the XMLHttpRequest. This defaults to