Skip to content
This repository

sub form submission lost #55

Closed
chabgood opened this Issue · 3 comments

2 participants

Chris Habgood Nathan Van der Auwera
Chris Habgood

I have a rails app using cocoon. I am using twitter bootstrap and have my screen split up. One side is a person and I have a content_for in my application file so the solutions will render on the other half of the screen. <%= yield(:solution_section) %> . When I submit the form it is not passing the solutions for data with the rest of the form. Is there a way to get this to work?

In the main person form I have this:

<%= content_for :solution_section do %>
<%= f.fields_for :solutions do |solution| %>
<%= render 'solution_fields', :f => solution %>
<%= link_to_add_association 'Add Solution', f, :solutions %>
<% end %>
<% end %>

Nathan Van der Auwera
Owner

What is important is that the HTML for editing the solutions are inside the form, because only fields inside the person-form will be submitted to the server. To me that seems to be what is going on.

Imho you cannot use the content_for but rather use two div's inside the form which you float to get the two-columns.

Is that clear to you?

If that is not clear, could you please show the complete form?

Chris Habgood

Ok, fixed, anyway, is there a way to grab data rom a div or something and send it along with a form post?

Nathan Van der Auwera
Owner

I do not know of a standard solution for that. You could define hidden fields in your form, and set them using javascript on submit.

Since your issue is now resolved, I am closing the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.