Open lukasburns opened 9 years ago
Same Issue with Rails '4.2.1' and remotipart 1.2.1. it does
Started POST "/operations/import" for 127.0.0.1 at 2015-06-10 18:03:50 -0430 Processing by OperationsController#import as / Parameters: {"object Object"=>{","=>{"object Object"=>{","=>{"object Object"=>nil}}}}}
...
Started POST "/operations/import" for 127.0.0.1 at 2015-06-10 18:03:50 -0430 Processing by OperationsController#import as JS Parameters: {"utf8"=>"✓", "commit"=>"Import", "remotipartsubmitted"=>"true", "X-Requested-With"=>"IFrame", "X-Http-Accept"=>"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, /_; q=0.01", "file"=>#<ActionDispatch::Http::UploadedFile:0x007fa88d514428 @tempfile=#<Tempfile:/tmp/RackMultipart20150610-5975-ldl9d9.csv>, @original_filename="test.csv", @content_type="text/csv", @headers="Content-Disposition: form-data; name=\"file\"; filename=\"test.csv\"\r\nContent-Type: text/csv\r\n">}
...
This happens when uploading a file and using this form for doing so (I'm using HAML so the reason for the syntax)
= form_tag import_operations_path, remote: true, method: :post, multipart: true , id: "csv_document"do
.row
.col-xs-4
= file_field_tag :file
.col-xs-4
= submit_tag "Import", id: "send_csv"
.col-xs-4
Also one of the resquests has params without the uploaded file (the one as /) while the other has the file as You can see in the code up
As a solution to avoid this double call while the error persist I used the the next coffeescript which prevents the empty request(the one without the file ) to fire and only sends the one with the file
$(document).ready ->
$('#send_csv').on 'click', (e) ->
e.preventDefault()
$('#csv_document').submit()
Same thing here with rails 5 and remotipart 1.3.1. I've been checking other issues related to "double submit" but none of them help me to resolve the problem.
Uncaught TypeError: $.rails.ajax(...).complete is not a function
from `jquery.remotipart``Thanks @monttda for the temporary workaround.
Catching Uncaught TypeError: $.rails.ajax(...).complete is not a function
too..
Is this still open issue, facing the same problem?
<%= semantic_form_for([blah, blah], remote: true ) do |f| %>
The first Request is Controller#create as JS works but I have the same TypeError:
Uncaught TypeError: $.rails.ajax(...).complete is not a function
Second Request Controller#create as HTML, because I don't have a handler for HTML 💥
is like jquery-ujs is not preventing its default functionality.
jqXHR.complete() callback was removed from jQuery 3.0. Using jqXHR.always() instead of jqXHR.complete() gets rid of 'Uncaught TypeError: $.rails.ajax(...).complete is not a function' error. So 'ajax:beforeSend.remotipart' event function returns 'false' properly, browser never fire default submit event (second request as HTML).
Hi, im using remotipart and paperclip for the file and it is posting twice and creating 2 objects, once with a html post and the second one with the JS post(the one I want). im using rails 4.2.1 and the lates version of remotipart. Hope someone could help me Thanx