Phoenix select と radio_button

■ selectタグの場合
[ruby]
<div class="form-group">
<%= label f, :gender, class: "control-label" %>
<%= select f, :gender_cd, ["男性": "1", "女性": "2", "その他": "0"], class: "control-label" %>
<%= error_tag f, :team %>
</div>
[/ruby]

■ radio button タグの場合
[ruby]
<div class="form-group">
<%= label f, :gender, class: "control-label" %>
<%= radio_button f, :gender_cd, "1", checked: true, class: "control-label" %>男性
<%= radio_button f, :gender_cd, "2", class: "control-label" %>女性
<%= radio_button f, :gender_cd, "0", class: "control-label" %>その他
<%= error_tag f, :team %>
</div>
[/ruby]

This entry was posted in Elixir, Phoenix Framework, 技術情報. Bookmark the permalink.

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です