Hi guys,
I am battling with the weirdest problem ever. I’m using rails 3.2.13 and trying to submit a form remotely and it keeps getting processed as HTML. I have the correct line in my application.js file namely:
#= require jquery
#= require jquery_ujs
I have the correct line in my form:
= simple_form_for :non_member_applcation, url: :non_member_applcation, remote: true, :html => {:id => “non-member-application”, multipart: true} do |f|
I have the correct route:
match ‘/non_member_applcation’ => ‘jobs#non_member_applcation’, as: :non_member_applcation
but when I click submit it just won’t work.
Also note that the form is in a modal, but I have done something similar to this before and it worked just fine. Any thoughts? Thanks
this is how the form looks when rendered:
this is how the form looks when rendered:
<form accept-charset="UTF-8" action="/non_member_applcation" class="simple_form non_member_applcation" data-remote="true" enctype="multipart/form-data" id="non-member-application" method="post" novalidate="novalidate">.....</form>
I'm pretty sure you still cannot do a remote form with a file input in it (the multipart/form-data business). I don't see a file input in the part that you posted here -- do you need this?
Walter
Yes, The form submits an uploaded file.
Yes, The form submits an uploaded file.
Then you're going to have to use another method to handle this; the keyhole iframe is a popular trick. Ajax form submissions don't handle file elements in a perfectly cross-platform manner, and some JavaScript toolkits actively exclude them as a means of leveling the playing field.
Walter