Forum: Ruby on Rails Submit a form remotely

B7ae888fe561d862e118b313ec4f205d?d=identicon&s=25 bertly_the_coder (Guest)
on 2013-11-12 12:50
(Received via mailing list)
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
B7ae888fe561d862e118b313ec4f205d?d=identicon&s=25 bertly_the_coder (Guest)
on 2013-11-12 13:06
(Received via mailing list)
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>
A47e0a6beeb9d048ff054fc1c3a97418?d=identicon&s=25 Walter Davis (walterdavis)
on 2013-11-12 14:06
(Received via mailing list)
On Nov 12, 2013, at 7:04 AM, bertly_the_coder wrote:

> 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
B7ae888fe561d862e118b313ec4f205d?d=identicon&s=25 muchira k. (Guest)
on 2013-11-12 14:58
(Received via mailing list)
Yes, The form submits an uploaded file.


On Tue, Nov 12, 2013 at 4:05 PM, Walter Lee Davis
<waltd@wdstudio.com>wrote:

> I'm pretty sure you still cannot do a remote form with a file input in it
> have the correct line in my application.js file namely:
> :non_member_applcation
> > To unsubscribe from this group and stop receiving emails from it, send
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/rubyonrails-talk...
> .
> To unsubscribe from this group and all its topics, send an email to
> rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/rubyonrails-talk...
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



--
Clarity is self-created. The universe is waiting on you, not the other
way
around - Me.

Life isn't about finding yourself. Life is about creating yourself. - G.
Bernard Shaw

"Life is what happens while you are busy making plans" - John Lennon

NAMASTE!!!!! Yeah I said it!!
A47e0a6beeb9d048ff054fc1c3a97418?d=identicon&s=25 Walter Davis (walterdavis)
on 2013-11-12 15:35
(Received via mailing list)
On Nov 12, 2013, at 8:56 AM, muchira k. wrote:

> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.