I'm new in Ruby on Rails and I'm trying to make to form_for
trigger a jQuery function.
My code for the form is the next:
<%= form_for @company, :url => create_paying_registration_path(:industry => apt(@plan.industry, :industries), :plan => @plan.name),
:html => {:id => "card-form"} do |f| %>
<%= render 'form_carrier', :company => @company, :plan => @plan, :f => f %>
<% end %>
And jQuery:
jQuery ($) ->
$("#card-form").submit ->
$form = $(this)
$form.find("button").prop "disabled", true
Conekta.token.create tokenParams, conektaSuccessResponseHandler, conektaErrorResponseHandler
false
return
The form doesn't trigger the jQuery function but if I use a form_tag
, it triggers the jQuery function:
<%= form_tag('/checkouts/charge', id: 'card-form') do %>
My question is, what am I doing wrong with form_for
? I need to trigger the jQuery and then redirect to the path from form.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire