我想将这种平衡支付形式转换为 rails-haml。我试过了,但我的提交按钮没有做任何事情。可能是因为我不知道如何在 form_for 之外提交提交。
这是他们作为示例给出的表格。单击此处查看 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"