JangoSteve / remotipart

Rails jQuery file uploads via standard Rails "remote: true" forms.
http://os.alfajango.com/remotipart
Other
1k stars 215 forks source link

remotipart response returned in browser POST response but is not inserted in to document when using cocoon gem? #188

Closed Lee1984 closed 6 years ago

Lee1984 commented 6 years ago

I am using cocoon gem cocoon to render out my file fields in the HTML dynamically so I can send them back to rails. The problem is between cocoon and remotipart. The problem being when pictures are sent with a valid or invalid form submission and you want to rerender the form partial to create pictures again. Whether it be a valid or invalid form submission if the form is submitted with pictures added with cocoon somewhere in the call back to the browser my response is not being inserted into the div its supposed to. The response is not inserted in to the HTML document however the entire response is in browser response body upon return. The response is valid, ie everything inside the <form> tags when pasted in to the document from response body shows exactly as it should but is not inserted into the document. THIS DOES NOT HAPPEN when I render a different view eg index where cocoon is not present so somewhere when cocoon is attached back to the view something is going wrong eg when remotipart does its thing and remotipart-submitted = true when you add pictures in server output something happens.

There are no js errors in the console.

I have narrowed down the problem to be in the form where fields_for is used with cocoon.

I was wondering if anyone could help me troubleshoot this?

Thanks.

nathanvda commented 6 years ago

This seems to be identical to #89 which is fixed by pull-request #179

Lee1984 commented 6 years ago

This issue is fixed with PR #179 as @nathanvda has just mentioned.

mshibuya commented 6 years ago

179 was merged as e0c2731 .