0

I'm trying to add dropzone inside a rails simple form with nested fields like this :

<%= simple_form_for(@product, url: create_product_path, method: :post, validate: true, :html => {:class => 'dropzone', multipart: true}) do |f| %>
<%= f.input :name %>
<%= f.input :price %>
<%= f.input :color %>
<%= f.input :description %>

<div class="fallback">
   <%= f.simple_fields_for :attachments do |a| %>
    <%= a.input :image, label: false, as: :file, input_html: { :multiple => true } %>
   <% end %>
 </div>

<%= f.button :submit, "Submit" %>
<% end %>

The dropzone area appears but instead of just showing only on the file input area it wraps around the entire form. Any idea what I might be doing wrong here?

enter image description here

Dev
  • 437
  • 6
  • 25
  • I'm pretty sure it's the `:class => 'dropzone'` on your whole form. Try removing that. – Siim Liiser Nov 06 '20 at 10:44
  • Thanks for the reply @Siim Liiser. If I remove the `:class => dropzone` then the dropzone area doesn't appear/work. – Dev Nov 06 '20 at 10:58
  • https://stackoverflow.com/questions/17872417/integrating-dropzone-js-into-existing-html-form-with-other-fields – Siim Liiser Nov 06 '20 at 14:01

0 Answers0