I want Uppy Dashboard’s upload data to be sent to a nested hidden field in a Rails form helper. I am stuck on two things.
-
The inspector error
Form plugin requires a <form> target element passed in options to operate, none was found
occurs even though the selector is applied to the<form>
element.js file
uppy.use(Form, { target: 'upload-data' })
erb file
<%= form_for @item, html: { class: "upload-data" } %>
upload-data
is the css selector on the form element. Why is it doing giving me that error? Additionally, this option does not save, because the data is not going to the nested form element I need it to go to. (see #2 below) -
If I add the
upload-data
selector to the nested hidden field like so…<%= f.fields_for :photos do |p| %> <%= p.hidden_field :image, value: @photo&.cached_image_data, class: "upload-data" %> <% end %>
…the form saves the image and everything else, as desired. I get the
Form plugin requires a <form> target element passed in options to operate, none was found
error here as well, but this time it makes sense.