最終更新:2019-06-18 (火) 15:07:09 (30d)  

Rails/Action View/フォームヘルパー はてなブックマークを見る
Top / Rails / Action View / フォームヘルパー

https://railsguides.jp/form_helpers.html

タグ

  • Rails/form_tag<%= form_tag("/search", method: "get") do %><form><div></div><div></div></form>
    Rails/label_tag?<%= label_tag(:q, "Search for:") %><label for="q">Search for:</label>
    Rails/text_field_tag?<%= text_field_tag(:q) %><input id="q" name="q" type="text" />
    Rails/submit_tag?<%= submit_tag("Search") %><input name="commit" type="submit" value="Search" />
    Rails/check_box_tag?<%= check_box_tag(:pet_dog) %><input id="pet_dog" name="pet_dog" type="checkbox" value="1" />
    Rails/radio_button_tag?<%= radio_button_tag(:age, "child") %><input id="age_child" name="age" type="radio" value="child" />
    Rails/text_area_tag?<%= text_area_tag(:message, "Hi, nice site", size: "24x6") %><textarea id="message" name="message" cols="24" rows="6">Hi, nice site</textarea>
    Rails/password_field_tag?<%= password_field_tag(:password) %><input id="password" name="password" type="password" />
    Rails/hidden_field_tag?<%= hidden_field_tag(:parent_id, "5") %><input id="parent_id" name="parent_id" type="hidden" value="5" />
    Rails/search_field?<%= search_field(:user, :name) %><input id="user_name" name="user[name]" type="search" />
    Rails/telephone_field?<%= telephone_field(:user, :phone) %><input id="user_phone" name="user[phone]" type="tel" />
    Rails/date_field?<%= date_field(:user, :born_on) %><input id="user_born_on" name="user[born_on]" type="date" />
    Rails/datetime_local_field?<%= datetime_local_field(:user, :graduation_day) %><input id="user_graduation_day" name="user[graduation_day]" type="datetime-local" />
    Rails/month_field?<%= month_field(:user, :birthday_month) %><input id="user_birthday_month" name="user[birthday_month]" type="month" />
    Rails/week_field?<%= week_field(:user, :birthday_week) %><input id="user_birthday_week" name="user[birthday_week]" type="week" />
    Rails/url_field?<%= url_field(:user, :homepage) %><input id="user_homepage" name="user[homepage]" type="url" />
    Rails/email_field?<%= email_field(:user, :address) %><input id="user_address" name="user[address]" type="email" />
    Rails/color_field?<%= color_field(:user, :favorite_color) %><input id="user_favorite_color" name="user[favorite_color]" type="color" value="#000000" />
    Rails/time_field?<%= time_field(:task, :started_at) %><input id="task_started_at" name="task[started_at]" type="time" />
    Rails/number_field?<%= number_field(:product, :price, in: 1.0..20.0, step: 0.5) %><input id="product_price" max="20.0" min="1.0" name="product[price]" step="0.5" type="number" />
    Rails/range_field?<%= range_field(:product, :discount, in: 1..100) %><input id="product_discount" max="100" min="1" name="product[discount]" type="range" />

Rails/Action View/モデルオブジェクトヘルパー

  • Rails/text_field?
  • Rails/text_area?