ruby-on-rails - 将平衡支付形式转换为 Rails

标签 ruby-on-rails balanced-payments

我想转换这个balanced payment形成rails-haml。我尝试过,但我的提交按钮没有执行任何操作。可能是因为我不知道如何在 form_for 之外提取提交。

这是他们作为示例给出的表格。 Click here to view the whole thing in Jsfiddle.

<form action="#" method="POST" id="credit-card-form">
    <fieldset>
        <legend>Credit Card Details</legend>
        <label>Card Number
            <input type="text"
                   autocomplete="off"
                   placeholder="Card Number"
                   class="cc-number" value="4111111111111111">
        </label>
        <label>Expiration
            <input type="text"
                   autocomplete="off"
                   placeholder="Expiration Month"
                   class="cc-em" value="01">
            <span>/</span>
            <input type="text"
                   autocomplete="off"
                   placeholder="Expiration Year"
                   class="cc-ey" value="2020">
        </label>
        <label>Security Code (CSC)
            <input type="text"
                   autocomplete="off"
                   placeholder="CSC"
                   class="cc-csc" value="123">
        </label>
        <button type="submit" class="btn">
            Tokenize
        </button>
    </fieldset>
</form>

这是我尝试过的

#credit-card-form
  = label_tag :card_number, "Credit Card Number"
  = text_field_tag :card_number, nil, name: nil, :value => "4111111111111111", class: "cc-number"
  %br
  = label_tag :card_code, "Security Code on Card (CVV)"
  = text_field_tag :card_code, nil, name: nil, :value => "123", class: "cc-csc"
  %br
  = label_tag :card_month, "Card Expiration"
  = select_month nil, {add_month_numbers: true}, {name: nil, id: "cc-em"}
  = select_year Date.new(2020), {start_year: Date.today.year, end_year: Date.today.year+15}, {name: nil, id: "cc-ey"}
  %br
  = submit_tag "Subscribe"

最佳答案

这样做

%form#credit-card-form{:action => "#", :method => "POST"}
  = label_tag :card_number, "Credit Card Number"
  = text_field_tag :card_number, nil, name: nil, :value => "4111111111111111", class: "cc-number"
  %p
  = label_tag :card_code, "Security Code on Card (CVV)"
  = text_field_tag :card_code, nil, name: nil, :value => "123", class: "cc-csc"
  %p
  = label_tag :card_month, "Card Expiration"
  = select_month nil, {add_month_numbers: true}, {name: nil, class: "cc-em"}
  = select_year Date.new(2020), {start_year: Date.today.year, end_year: Date.today.year+15}, {name: nil, class: "cc-ey"}
  %p
  / = submit_tag "Subscribe"
  %button.btn{:type => "submit"}
    tokenize

关于ruby-on-rails - 将平衡支付形式转换为 Rails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17758369/

相关文章:

javascript - Balanced-JS 返回 404

javascript - balanced.init() 上的 JS 错误

ruby-on-rails - 之前的工厂女孩​​(:create) callback not creating associations

ruby-on-rails - Rails 3.1 Assets 在生产中被指纹识别,但渲染的 HTML 不是

payment-gateway - "Not permitted to perform create on holds"

ios - 如何在 iOS 中使用平衡支付将 href 发送到服务器进行支付处理

mysql - rails : Sidekiq cannot find the created record

ruby-on-rails - 如何使用 Active Admin 执行批量操作

javascript - rails : couldn't find file 'typeahead.js' . 。直到我删除 'data-turbolinks'