views:

221

answers:

2

I have a form that will not submit:

<% form_for :venue, :html => { :id => "create_venue_form" } do |f| %>
    <%= render :partial => 'venues/venue_form_fields', :locals => { :f => f } %>
    <%= submit_to_remote 'add_venue_button', 
                      'Save Venue',
             { 
            :url => add_venue_path(@user.id),
            :before => "alert(this.form);",
            :html => {
               :id => "add_venue_button"
            },
            :update => "venue_select"
                      }
    %>
<% end %>

The problem is that this.form is null when prototype goes to serialize the form. I have put the alert statement in other forms and this.form popped up to be an HTML form element, so I know it should not be evaluating to null.

Does anyone know why this might be happening?

Thanks!

+1  A: 

You can't create nested forms in HTML. You can put that nested form in a div and use serializeElements to serialize all inputs within that div.

Tomas Markauskas
A: 

If you are doing an AJAX update, which is how it appears, you should look at remote_form_for

Peer

Peer Allan