У меня есть форма в приложении rails, которая имеет 3 входа.Мне нужно передать 3 входа в функцию CoffeeScript.Как я могу передать эти переменные в coffeescript, как только они введены.Вот мой взгляд.
<%= form_tag( '/welcome/how_much', post: true, remote: true) do %>
<span id="questions">
<h5 class="label">Estimated new home cost?</h5>
<%= text_field(:amount, {id: "house_amount", placeholder: "ex. 100,000"}, class: "form-control form-control-lg") %>
</span>
<span id="questions">
<h5 class="label">Estimated payment for a new home?</h5>
<%= text_field(:high_rent, {id: "high_rent", placeholder: "ex. 1,200"}, class: "form-control form-control-lg") %>
</span>
<span id="questions">
<h5 class="label">Current Monthly Rent?</h5>
<%= text_field(:current_rent, {id: "current_rent", placeholder: "ex. 800"}, class: "form-control form-control-lg") %>
</span>
<%= submit_tag("See how quickly you can buy a home", data: {'data-toggle' => "modal", 'data_target' => "#savings_modal"}, class: "btn btn-success btn-lg") %>
<!-- Modal for sign-up -->
<div class="modal" id="savings_modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<h3 class="modal-title" id="savingsModalTitle">You could be ready to buy in <%= @months_to_buy %> months</h3>
<h5 class="modal-title">and have <%= @total_savings %>* to put towards a down payment & a drastically increased credit score using LikeHome</h5>
<div class="modal-body">
<h4>Sign-up Now to get started!</h4>
<%= render '_tenant_signup_modal_form.html.erb' %>
</div>
</div>
</div>
</div>