jangosteve / remotipart Goto Github PK
View Code? Open in Web Editor NEWThis project forked from leppert/remotipart
Rails jQuery file uploads via standard Rails "remote: true" forms.
Home Page: http://os.alfajango.com/remotipart
License: Other
This project forked from leppert/remotipart
Rails jQuery file uploads via standard Rails "remote: true" forms.
Home Page: http://os.alfajango.com/remotipart
License: Other
Hi,
I'm having a strange issue here. I have a multipart form and everything works except when I submit a file and have a validation error in another field. When that happens, I get an HTTP 422 status, as I should, because I told it to do that, but I'm also getting the ajax:success
event triggered and the xhr status code therein is 200. I'm confused!
Non-multipart forms work as expected, and so do multipart forms with no validation errors, and multipart forms with no file attached.
I circumnavigated the problem for the moment by having two forms... not ideal, but not really a huge problem.
Any thoughts?
Thanks!
-Trevor
I'm running Rails (3.2.8), jquery-rails (2.1.3) and remotipart (1.0.2). Any time I have a file upload in the form I receive the response, but it isn't parsed as javascript - in my inspector I receive the following:
Resource interpreted as Document but transferred with MIME type text/javascript:
I'm also not receiving an 'ajax:success' event. It's returning a 200, the post is submitted, file is saved etc. Out of ideas here...
Is it possible to use remotipart without ActiveRecord? For example, if my app doesn't have any database component, can I still use remotipart to maintain the files in a directory?
I'm working through the rails 3.1 sample app and getting a bit mired in the database stuff... we're not using any ActiveRecord in our app.
I have an AJAX file upload with remotipart working in development.
When I use it in production, I get 406 errors because the request's format as far as the controller is concerned is text/html
. In development it is text/javascript
as expected.
There are two differences between development and production:
I wonder whether I need to tell Nginx to pass through any extra headers to Unicorn?
Some HTML code is messed up due to quotes and the like if AJAX is delivered through remotipart. For a demo, head over to http://shielded-savannah-6910.herokuapp.com/ and look at the encoding in the AJAX responses. Basically, if I have
<% c = '"' %>
<input type="text" value="<%= h c %>">
or
<%= text_field_tag :name, c %>
Then this HTML does not put the value attribute with a double quote if delivered through remotipart, but does the expected thing without remotipart. Remotipart should not change the default behavior of views.
The partial delivered is at https://github.com/yasirs/encoding-demo/blob/hero/app/views/application/_form_partial.html.erb
From the log, I found that the format is HTML
instead of JS
I'm using rails 3.2.6, ruby 1.9.3, jquery 1.7
The IFRAME throws a security violation exception for parents with a value set for document.domain
. The IFRAME should inherit the document.domain of the parent to avoid this.
If you add
gem 'wicked_pdf'
to the Gemfile in https://github.com/JangoSteve/Rails-jQuery-Demo/tree/remotipart the render method created in the RenderOverrides module include to ActionController::Base never gets run during regular request processing, and therefore renders remotipart's response handling on the client side nonfunctional.
wicked_pdf is monkeying around with method chaining of render inside one of their ActionController::Base-included modules, perhaps that has something to do with it:
def self.included(base)
base.class_eval do
alias_method_chain :render, :wicked_pdf
alias_method_chain :render_to_string, :wicked_pdf
after_filter :clean_temp_files
end
end
Smells to me like one or both projects are doing something inadvisable, but I really don't have the depth of expertise to make that assessment.
See mileszs/wicked_pdf#111 for more details.
Remotipart should send this header so that it is unnecessary to specify it with a hidden input.
I have inside a fancybox box this form:
<%= simple_form_for(@message, :remote => true, :html => {:multipart => true}, :url => { :controller => "users/messages", :action => "create"} ) do |f| %>
<%= f.error_notification %>
<%= f.input :subject, :input_html => { :maxlength => 500} %>
<%= f.input :message_image, :as => :file %>
<%= f.button :submit, t('.send_message'), :class => 'btn-large btn-primary', "data-disable-with" => t('.send_message'), :confirm => t('.sure_send_message') %>
<% end %>
This is my create action:
def create
@message = Message.new(params[:message])
respond_to do |format|
if @message.save
format.js { render :partial => "users/messages/templates/sent_by_user/create" }
else
format.js { render :partial => "users/messages/templates/sent_by_user/nosave" }
end
end
end
The files create.js.erb
or nosave.js.erb
file is working fine if I don't try upload a image
If I try upload a image this files is not rendered.
However in my log I can see:
Processing by Users::MessagesController#create as JS
Parameters: {"message"=>{"message_image"=>#<ActionDispatch::Http::UploadedFile:0xf7a85c8 @original_filename="cara_enfadada.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"message[message_image]\"; filename=\"cara_enfadada.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20121015-21710-6oxtn2>>, "subject"=>"estrella de neutronessssssssssss"}, "commit"=>"Enviar mensaje", "utf8"=>"✓", "authenticity_token"=>"mfSsl0HafWoW86YiO2Hj7zMepAITZlHHBtUqW0wzubU=", "remotipart_submitted"=>"true", "X-Requested-With"=>"IFrame", "X-Http-Accept"=>"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01", "locale"=>"es"}
and
Rendered users/messages/templates/sent_by_user/_nosave.js.erb (0.2ms)
Completed 200 OK in 498ms (Views: 1.5ms | Solr: 0.0ms)
On google chrome console I get the next alert:
Resource interpreted as Document but transferred with MIME type text/javascript:
I'm using remotipart gem but I dont find the error...
Where is the error?
Thank you
After I apply the remotipart, the form submit works fine with ajax. But the ujs callback that provided from Rails seems not working. So how can I make it work again? Thanks.
BTW, I am using JQuery 1.7.1. .on() for binding the ajax:success. And I put alert there which has nothing popup. Not sure if it's the case of the JQuery version.
Using remotipart 1.02, Rails 3.2.11, jquery-rails-2.2.0, the file is uploaded and saved perfectly, but the request is processed as HTML instead of JS.
Started PUT "/pictures/4?attribute=image&form_element=image_field&update=picture_4_image" for 127.0.0.1 at 2013-01-31 22:26:07 -0400
Processing by PicturesController#update as HTML
Using remotipart 1.02, Rails 3.2.6, jquery-rails-2.0.2 it all works as expected:
Started PUT "/pictures/878?attribute=image&form_element=image_field&update=picture_878_image" for 127.0.0.1 at 2013-01-31 22:40:28 -0400
Processing by PicturesController#update as JS
Using latest rails, rails-jquery and remotipart. When using :disable_with it works when no file is selected/ uploaded in the form. When a file is selected and uploaded, the button is not disabled. It seems the jquery-rails "data-disable-with" handler is not executed anymore.
I'm using rails 3.2.6 and the last version of remotipart. The ajax:success callback is not being being called when the form is submitted. Right now i'm using ajax:complete to make the functionality work
I worked fine with firefox and chrome but when I upload by IE8. I show issue on console:
ERROR invalid body size
Please help me solved this problem.
It looks like when you use…
render :collection => @items, :partial => 'item'
…the response is not wrapped in the textarea, and each of the rendered items have the outermost element stripped off of them in JS (the response contains them, but the ajax:success
data does not).
Edit: Actually, it doesn't look like it ever works. I've restarted my app, but it doesn't appear to change the situation. For whatever reason, ajax:success
won't fire if I return HTML from a POST request without specifying data-type="html"
on the remote form. Maybe this is related, but I'm stumped. I have yet to get Remotipart requests to respond with anything wrapped in a textarea.
And for the record, I'm using unobtrusive JS, NOT the hackish Rails 2 .js.erb
views that are soon to be deprecated.
When I submit the form using .ajax with dataType: 'script', the server returns a javascript function in create.js.erb which being merged with soem HTML i.e.
jquery(...)
Any idea how to solve this?
The FileAPI seems moderately well supported in modern browsers:
http://caniuse.com/#feat=fileapi
Would there be interest in getting remotipart to use the native javascript support for uploading files via XMLHttpRequest when possible, and "degrading" to the iframe version when necessary?
There are some additional nice things that could be done if the FileAPI is used (such as monitoring progress), but I assume most of us aren't quite ready to drop support for all IE users.
Hi Steve,
First off, awesome gem from you and leppert. Thanks! Question, can I use
I don't know when the problem started, because it used to work for me, but with a new app using rails 3.2.12, the remotipart middleware no longer recognizes the incoming params so the Accepts header is not set properly. I will submit a fix shortly.
Is the a way to upload a file and other form data in one request without hacking around js and the server code? If I add data and files to .ajax() call - it merges data and misses some file uploads data on submission.
the assets pipe has issues with putting things in the public folder so I moved the two js files from public to the assets folder.
Hi. I write the code so can not speak English.
controller
render :js => "alert('& & > > < < \" "')"
response.body
<textarea data-type="text/javascript" response-code="200">alert('& & > > < < " "')</textarea>
alert
& & > > < < " "
edit lib/remotipart/render_overrides.rb
# response.body = %{<textarea data-type=\"#{content_type}\" response-code=\"#{response.response_code}\">#{escape_once(response.body)}</textarea>}
response.body = %{<textarea data-type=\"#{content_type}\" response-code=\"#{response.response_code}\">#{ERB::Util.h(response.body)}</textarea>}
response.body
<textarea data-type="text/javascript" response-code="200">alert('& &amp; > &gt; < &lt; " &quot;')</textarea>
alert
& & > > < < " "
I'm using remotipart 1.0.2, jquery 1.6.4, jquery-rails 1.0.16, Rails 3.0.11.
I have a form uploading a file by AJAX and remotipart to my Rails app. The controller returns a .js.erb response. Everything works in Safari and Chrome, but IE8 simply displays a textarea containing my javascript (from the .js.erb).
I assumed there was a syntax error in that javascript, but when I paste it into IE8's script debugger and run it, I get simply "Object expected" (without a line number). I have Googled for this error message but haven't found anything that seems to apply. I'm not sure how else to check the javascript.
Aside from remotipart, I have ajax:success
, ajax:error
and ajax:complete
event handlers bound to the form using live
.
I'd be very grateful for any help!
Hi,
I've got a form that contains a few buttons that controll various actions in the controller. In rails_ujs the clicked button is registered by the following code
$(document).delegate(rails.formInputClickSelector, 'click.rails', function(event) {
var button = $(this);
if (!rails.allowAction(button)) return rails.stopEverything(event);
// register the pressed submit button
var name = button.attr('name'),
data = name ? {name:name, value:button.val()} : null;
button.closest('form').data('ujs:submit-button', data);
})
Now there's a function called handleRemote in jquery_ujs that sets
data = element.serializeArray();
// memoized value from clicked submit button
var button = element.data('ujs:submit-button');
if (button) {
data.push(button);
element.data('ujs:submit-button', null);
where element is the submitted form und data the array to generate the params hash from. The problem is the last line, where 'ujs:submit-button' is set to null, so I don't have access to it later. So I tried this in my fork of remotipart, which failed:
At the top I added
$(function() {
$(document).delegate(rails.formInputClickSelector, 'click.rails', function(event) {
var button = $(this);
if (!rails.allowAction(button)) return rails.stopEverything(event);
// register the pressed submit button
var name = button.attr('name'),
data = name ? {name:name, value:button.val()} : null;
button.closest('form').data('ujs:remotipart-submit-button', data);
});
});
and a few lines further down
settings.files = $($.rails.fileInputSelector, form);
settings.data = form.serializeArray();
var button = form.data('ujs:remotipart-submit-button');
if (button) {
settings.data.push(button);
form.data('ujs:remotipart-submit-button', null);
}
This doesn't work and I wonder why. Is it a bug in the remaining javascript or do I get the meaning of the "delegate" method wrong?
I'm trying to move my file upload processing into a separate Rails app at a different subdomain.
Unsurprisingly, my initial attempt of changing the URL of the upload form to the new subdomain hasn't worked (getting cross domain errors in the Safari console).
Any thoughts on how to get this working with Remotipart?
when I include gem jquery-fileupload-rails and use its middleware, my server response becomes
<!DOCTYPE html><html>
<body><textarea data-status='200' data-statusText='OK' data-type='text/html'>
<textarea data-type="text/javascript" response-code="200">
...lines of jquery code...
</textarea>
</textarea></body></html>
then the js code was not evalutated.
jquery-fileupload-rails middleware wrap a new textarea tag which generated by https://github.com/tors/jquery-fileupload-rails/blob/master/lib/jquery/fileupload/rails/middleware.rb#L25
and broken remotipart.
I don't think it's a problem of remotipart. and I create the issue to help other guys who blocked on this problem and it should be closed later.
But I curious why set response.content_type = Mime::HTML in https://github.com/JangoSteve/remotipart/blob/master/lib/remotipart/render_overrides.rb#L17
Having this error on IE9 (jquery.iframe-transport.js line 209). I tried to use this pull request but still same thing happens. Using jquery-rails (2.1.1). Any help would greatly be appreciated.
Edit: Testing from IE9 on windows computer and server is in my computer mac.
Edit2: Also happens on IE8.
Just setting up remotipart for the first time with an existing rails 3.2 project. I'm using a similar setup for ajax that is described here: http://www.alfajango.com/blog/rails-3-remote-links-and-forms-data-type-with-jquery/
Trying out remotipart, my file is uploaded fine and my page gets a response back. I get an event for ajax:complete that has my js.erb response in the xhr.responseText.
The problem is that response js is never executed in the client browser. My impression is that it should be executed. Is that not correct? I can't find any documentation that shows how this should be handled. Apologies if I missed it.
Thanks!
Im trying to use remotipart on a project, and everything is great, but, all the link_to :remote that I have stop to work. the request from those links change from JS to HTML when I added remotirpart
Im using all bleeding edge, rails 3.2.6 and ruby 1.9.3
Help please
In your blog page at
http://www.alfajango.com/blog/remotipart-rails-gem/
there's a link to 'Report bug or request feature' that points to
hhttps://github.com/JangoSteve/remotipart/issues
which is broken... has an extra 'h' on the front of it
Hello,
I am using Rails 3.0.7 and remotipart 1.0.1 with jquery-rails 1.0.19 .
Everything works just fine but after the request gets submitted the result does not get executed. I get the result surrounded by:
<textarea data-type="text/javascript" response-code="200"> ... JS code ...</textarea>
which from what I've read on the home page would need to be executed but it's not.
Can you please guide me to debugging this issue?
Thank you,
Rares
I tried to use remotipart(1.0.2) with rails version 3.2.3. I felt these two gems are not compatible with each other. The helper method remotipart_submitted?
was returning false
. So I downgraded rails to 3.1.6 and remotipart to 1.0, now, it seems they are working together.
In IE9 with a Rails 3.1.3 app (jQuery 1.7.1), I get duplicate records when submitting a form using remotipart. Has anyone experienced this?
Hi,
is it possible to make status bar for file upload through remotipart?
We are using it for image upload and this would be nice.
I'm probably using this wrong, but if I submit an empty file (just clicking upload without a file in the upload field) the js in the response executes - (the response being "alert('uploaded')". If I actually upload a file I get HTML in the response and it doesn't execute, instead I get the following response:
<!DOCTYPE html><html><body><textarea data-status='200' data-statusText='OK' data-type='text/html'><textarea data-type="text/javascript" response-code="200">alert('uploaded.');
</textarea></textarea></body></html>
If it helps, the form doesn't relate to any model, I am attempting to use it to upload a csv file via ajax, and then append the contents of it to a textarea.
Remotipart has been working great for me in the past. I recently noticed that it has stopped working on POST/Create and PUT/Update.
No rails errors or javascript errors are generated. I can see in my console that the images are resized and uploaded correctly via Paperclip to AWS, and that Rails goes through all the follow up steps as expected, trying to render the new data.
However, nothing happens. When I look at Network activity in the Chrome I can see the post method appearing as canceled and pending in red.
I saw that this may be related to jquery 1.9+ and jquery_ujs, so I tried adding in the jquery migration script but it didn't change anything for me. It didn't look like I was on one of troubled jquery-rails versions either.
Here are some gem versions that may help:
Using rake (10.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using aws-sdk (1.8.5)
Using railties (3.2.13)
Using rails (3.2.13)
Using fancybox-rails (0.2.1)
Using jquery-rails (2.2.1)
Using jquery-ui-rails (4.0.2)
Using paperclip (3.0.4)
Using remotipart (1.0.5)
Vendors a version of jquery_ujs that breaks. I have not investigated why.
Hello
I have some problems, not really big but rather important
All forms in my app have :disable_with param on submit buttons, but forms with remotipart loaded files are not disabling their buttons...So it looks like form is not submitting and it is not very user friendly
As I understand the thing is that form with remotipart is submited asynchronously - that's why it's not disabling. Is there any way to make this work or the only way is to disable button manually on click?
<textarea data-type="text/javascript" response-code="200">
var el = $('#new-category');
$("#success").text(The category has been successfully created.);
$("#success").removeClass("hide");
$(el).modal('hide');
</textarea>
gets returned, doesn't get executed.
View below:
<%= remotipart_response do %>
var el = $('#new-category');
<% if @category.errors.any? %>
var errors = $('<ul />');
<% @category.errors.full_messages.each do |error| %>
errors.append('<li><%= error %></li>');
<% end %>
// Display errors on form
el.find('#modal-errors').html(errors);
$("#modal-errors").removeClass("hide");
<% else %>
$("#success").text(<%= flash[:notice] %>);
$("#success").removeClass("hide");
$(el).modal('hide');
<% end %>
<% end %>
Running Rails 3.2.6.
I have a global jQuery.ajaxError handler registered ( $('body').ajaxError() { ....} ) and remotipart causes it to be triggered under normal conditions, i.e. when a file is submitted. I think is because this gem uses:
$('form').live('ajax:aborted:file', function() ...
Just wanting to confirm this is indeed normal behaviour and wondering if there's any way to prevent it from happening.
(Thanks for this great plugin btw.)
I have a form for uploading a file.
<%= form_for @import, remote: true do |f| %>
<fieldset>
<%= f.label :file, "Attach a CSV file" %>
<%= f.file_field :file %>
</fieldset>
<%= f.submit :upload %>
<% end -%>
Unfortunately, when I submit the form with a file attached, it doesn't seem to arrive at my controller action correctly. The params hash has stringified JS objects as keys.
Started POST "/file_imports" for 127.0.0.1 at 2012-11-06 01:00:49 +0000
Processing by FileImportsController#create as JS
Parameters: {"object Object"=>{","=>{"object Object"=>{","=>{"object Object"=>nil}}}}}`
Looking into the Remotipart source, I can't seem to understand what it is supposed to do. For example, in vendor/assets/javascripts/jquery.remotipart.js
, Line 22 has the following:
settings.data = form.serializeArray();
A little further down, the settings are sent to the server via $.rails.ajax(settings)
.
The $.fn.serializeArray()
method returns an array of JS objects. If we assign them to the data attribute of a call to jQuery.ajax()
, that would account for the serialized object parameters I'm seeing on the server. We need to pass an object as the data attribute, not an array of objects?
Am I doing something wrong or how exactly is this meant to work?
I upgraded jquery-rails in my rails 3.2.8 app and an ajax form submit with file input stopped working. Rails logs showed that the POST contained all the of the form data except the file input. Works fine with 2.0.2.
Here's my bundle log:
Updating https://github.com/bradphelan/rocket_tag.git
Fetching gem metadata from https://rubygems.org/......
Fetching gem metadata from https://rubygems.org/..
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.5)
Using activesupport (3.2.2)
Using builder (3.0.0)
Using activemodel (3.2.2)
Using erubis (2.7.0)
Using journey (1.0.3)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.2)
Using mime-types (1.18)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.2)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.2)
Using activeresource (3.2.2)
Using multi_xml (0.5.1)
Using httparty (0.8.3)
Using json (1.7.3)
Using nokogiri (1.5.2)
Using uuidtools (2.1.2)
Using aws-sdk (1.5.1)
Using sass (3.1.18)
Using bootstrapped-rails (2.0.7.9)
Using bundler (1.1.3)
Using rack-ssl (1.3.2)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.2)
Using chosen-rails (0.9.8)
Using cocaine (0.2.1)
Using coffee-script-source (1.3.2)
Using execjs (1.3.2)
Using coffee-script (2.2.0)
Using coffee-rails (3.2.2)
Using dalli (2.0.5)
Using unf_ext (0.0.4)
Using unf (0.0.5)
Using domain_name (0.5.3)
Using faker (1.0.1)
Using jquery-rails (2.0.2)
Using kaminari (0.13.0)
Using kgio (2.7.4)
Using net-http-digest_auth (1.2)
Using net-http-persistent (2.6)
Using ntlm-http (0.1.1)
Using webrobots (0.0.13)
Installing mechanize (2.5.1)
Using mysql2 (0.3.11)
Using newrelic_rpm (3.3.4.1)
Using pacecar (1.5.3)
Using paper_trail (2.6.3)
Using paperclip (3.0.3)
Using polyamorous (0.5.0)
Using rails (3.2.2)
Using raindrops (0.8.1)
Using remotipart (1.0.2)
Using squeel (1.0.1)
Using rocket_tag (0.3.1) from https://github.com/bradphelan/rocket_tag.git (at master)
Using ruby-ole (1.2.11.3)
Using sass-rails (3.2.5)
Using spreadsheet (0.6.5.8)
Using sqlite3 (1.3.6)
Using to_xls (1.5.0)
Using uglifier (1.2.4)
Using unicorn (4.3.1)
Using wicked_pdf (0.7.9)
�[32mYour bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.�[0m
I've checked the code many times, it's everything in place, just like the demo show us. Actually it worked for a week, but then it stopped working and I can't seem to restore it.
I'm using remotipart to upload files. I found out that the javascript callback is not coming with that textarea data-type...
thing wrapping it, and the webkit console tells it was transferred as javascript but parsed as a document (rails console points it as JS).
Don't know what to do. I'm currently trying to hardcode the <textarea> thing and see if it works.
Update. It didn't. =(
I'm in a little hurry here so I gave up remotipart and made my own iframe-ajax-uploader. Anyways I still looking forward to get this fixed.
Except the live / on compatibility problem mentioned previously it seems there is another compatibility problem :
Everything works fine with Rails 3.2.11 / jquery-rails 2.1.4 (jquery 1.8.3) and I got th following :
Processing by Adminapp::AlbumsController#update_avatar as JS
Parameters: {"album"=>{"avatar_attributes"=>{"asset"=>#<ActionDispatch::Http::UploadedFile:0x9e65754 @original_filename="diaporama-AAK.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"album[avatar_attributes][asset]\"; filename=\"diaporama-AAK.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20130121-28398-nvf7tn>>, "id"=>"5"}, "title"=>"Singapore", "description"=>"Photos of new year"},
"utf8"=>"✓", authenticity_token"=>"8wUgkSz6rwNohY2VMncHYp8a9uI8Av5777DvO16QBXg=", "remotipart_submitted"=>"true", "X-Requested-With"=>"IFrame", "X-Http-Accept"=>"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01", "id"=>"7", "locale"=>"en"}
But with jquery-rails 2.2.0 (jquery 1.9.0) I got this :
Processing by Adminapp::AlbumsController#update_avatar as JS
Parameters: {"album"=>{"avatar_attributes"=>{"asset"=>"diaporama-AAG.jpg", "id"=>"5"}, "title"=>"Singapore", "description"=>"Photos of new year"}, "utf8"=>"✓", "authenticity_token"=>"8wUgkSz6rwNohY2VMncHYp8a9uI8Av5777DvO16QBXg=", "remotipart_submitted"=>"true", "X-Requested-With"=>"IFrame", "X-Http-Accept"=>"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01", "id"=>"7", "locale"=>"en"}
It's like remotipart do not take the Asset object anymore but only the name of the file.
I tried debug it but my Javascript knowledge is very poor.
Fred.
Using latest rails, rails-jquery and remotipart.
My rails app renders a js template after the submit. When no file is selected/ uploaded in the form everything works fine.
When a file is selected/ uploaded, the response is not interpreted as javascript anymore. As the response header still shows the correct content type "Content-Type:text/javascript; charset=utf-8", I assume something in remoitpart's response handling must be wrong.
Hi, I'm under rails 3.2.1 with jquery 1.7.1 and I get this error when I try to submit a form
Uncaught TypeError: Object [object Object] has no method 'ajaxSubmit'
here my js include
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require jquery.remotipart
//= require twitter/bootstrap
and my form
= form_for VideoInterview.new, :url => video_interviews_path, :html => { :class => :form, :multipart => true }, :remote => true do |f|
.showitem
= f.label :title, t("activerecord.attributes.video_interview.title", :default => "Title"), :class => :label
.input
= f.text_field :title, :class => 'text_field'
.showitem
= f.label :title, t("activerecord.attributes.video_interview.file"), :class => :label
.input
=f.label :file
= f.file_field :file
.clearF
.separator
.form-actions
%button{:class => "btn primary", :type => "submit"} Save
any hint?
works with rails 3.2.3 ?
I don't know if maybe it's something that changed in the more recent version of rails, or something with a newer version of jquery, but this gem is not working. Something is happening on the client side, the post request is not being sent via I-Frame. remotipart_submitted is never true.
Rails 3.2.8
jQuery 1.7.2
I found that if I put the latest git version of jquery-iframe-transport in my assets to override the one provided by the gem, that it works, except that the returned javascript inside the textarea tag does not get evaluated. I added a little one-liner
eval( textarea.value );
hack into the jquery-iframe-transport and I have the functionality I want now, but the gem by itself is just not working.
This works flawlessly locally in Development, but not so much on Production... The main difference is remote and compresses assets served via CDN.... I planned to test this later tonight, but I was wondering if you would happen to know if there is an issue with compressed JS, why this acts inconsistent?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.