Padrino::Helpers::FormHelpers
Module: Padrino::Helpers::FormHelpers
Overview
Helpers related to producing form related tags and inputs into templates.
Defined Under Namespace
Modules: Errors, Options, Security
Constant Summary
- DATETIME_ATTRIBUTES =
[:value, :max, :min].freeze
- COLOR_CODE_REGEXP =
/\A#([0-9a-fA-F]{3}){1,2}\z/.freeze
Instance Method Summary
-
#button_tag(caption, options = {}) ⇒ String
Constructs a button input from the given options. -
#button_to(*args, &block) ⇒ String
Creates a form containing a single button that submits to the URL. -
#check_box_tag(name, options = {}) ⇒ Object
Constructs a check_box from the given options. -
#color_field_tag(name, options = {}) ⇒ Object
Constructs a color tag from the given options. -
#date_field_tag(name, options = {}) ⇒ String
Constructs a date tag from the given options. -
#datetime_field_tag(name, options = {}) ⇒ String
Constructs a datetime tag from the given options. -
#datetime_local_field_tag(name, options = {}) ⇒ String
Constructs a datetime-local tag from the given options. -
#email_field_tag(name, options = {}) ⇒ String
Creates an email field input with the given name and options. -
#field_set_tag(*args, &block) ⇒ String
Constructs a field_set to group fields with given options. -
#fields_for(object, options = {}, &block) ⇒ String
Constructs form fields for an object using given or default form_builder. -
#file_field_tag(name, options = {}) ⇒ Object
Constructs a file field input from the given options. -
#form_for(object, url, options = {}, &block) {|AbstractFormBuilder| ... } ⇒ String
Constructs a form for object using given or default form_builder. -
#form_tag(url, options = {}, &block) ⇒ String
Constructs a form without object based on options. -
#hidden_field_tag(name, options = {}) ⇒ Object
Constructs a hidden field input from the given options. -
#hidden_form_method_field(desired_method) ⇒ String
Returns the hidden method field for 'put' and 'delete' forms. -
#image_submit_tag(source, options = {}) ⇒ String
Constructs a submit button from the given options. -
#label_tag(name, options = {}, &block) ⇒ String
Constructs a label tag from the given options. -
#month_field_tag(name, options = {}) ⇒ String
Constructs a month tag from the given options. -
#number_field_tag(name, options = {}) ⇒ String
Creates a number field input with the given name and options. -
#password_field_tag(name, options = {}) ⇒ Object
Constructs a password field input from the given options. -
#radio_button_tag(name, options = {}) ⇒ Object
Constructs a radio_button from the given options. -
#range_field_tag(name, options = {}) ⇒ String
Constructs a range tag from the given options. -
#search_field_tag(name, options = {}) ⇒ String
Creates a search field input with the given name and options. -
#select_tag(name, options = {}) ⇒ String
Constructs a select from the given options. -
#submit_tag(*args) ⇒ String
Constructs a submit button from the given options. -
#telephone_field_tag(name, options = {}) ⇒ String (also: #phone_field_tag)
Creates a telephone field input with the given name and options. -
#text_area_tag(name, options = {}) ⇒ Object
Constructs a text area input from the given options. -
#text_field_tag(name, options = {}) ⇒ String
Creates a text field input with the given name and options. -
#time_field_tag(name, options = {}) ⇒ String
Constructs a time tag from the given options. -
#url_field_tag(name, options = {}) ⇒ String
Creates a URL field input with the given name and options. -
#week_field_tag(name, options = {}) ⇒ String
Constructs a week tag from the given options.
Instance Method Details
#button_tag(caption, options = {}) ⇒ String
Constructs a button input from the given options.
#button_to(caption, url, options = {}) ⇒ String #button_to(url, options = {}, &block) ⇒ String
Creates a form containing a single button that submits to the URL.
#check_box_tag(name, options = {}) ⇒ Object
Constructs a check_box from the given options.
#color_field_tag(name, options = {}) ⇒ Object
Constructs a color tag from the given options.
#date_field_tag(name, options = {}) ⇒ String
Constructs a date tag from the given options.
#datetime_field_tag(name, options = {}) ⇒ String
Constructs a datetime tag from the given options.
#datetime_local_field_tag(name, options = {}) ⇒ String
Constructs a datetime-local tag from the given options.
#email_field_tag(name, options = {}) ⇒ String
Creates an email field input with the given name and options.
#field_set_tag(legend = nil, options = {}, &block) ⇒ String #field_set_tag(options = {}, &block) ⇒ String
Constructs a field_set to group fields with given options.
#fields_for(object, options = {}, &block) ⇒ String
Constructs form fields for an object using given or default form_builder. Used within an existing form to allow alternate objects within one form.
#file_field_tag(name, options = {}) ⇒ Object
Constructs a file field input from the given options.
#form_for(object, url, options = {}, &block) {|AbstractFormBuilder| ... } ⇒ String
Constructs a form for object using given or default form_builder.
#form_tag(url, options = {}, &block) ⇒ String
Constructs a form without object based on options.
#hidden_field_tag(name, options = {}) ⇒ Object
Constructs a hidden field input from the given options.
#hidden_form_method_field(desired_method) ⇒ String
Returns the hidden method field for 'put' and 'delete' forms. Only 'get' and 'post' are allowed within browsers; 'put' and 'delete' are just specified using hidden fields with form action still 'put'.
#image_submit_tag(source, options = {}) ⇒ String
Constructs a submit button from the given options.
#label_tag(name, options = {}, &block) ⇒ String
Constructs a label tag from the given options.
#month_field_tag(name, options = {}) ⇒ String
Constructs a month tag from the given options.
#number_field_tag(name, options = {}) ⇒ String
Creates a number field input with the given name and options.
#password_field_tag(name, options = {}) ⇒ Object
Constructs a password field input from the given options.
#radio_button_tag(name, options = {}) ⇒ Object
Constructs a radio_button from the given options.
#range_field_tag(name, options = {}) ⇒ String
Constructs a range tag from the given options.
#search_field_tag(name, options = {}) ⇒ String
Creates a search field input with the given name and options.
#select_tag(name, options = {}) ⇒ String
Constructs a select from the given options.
#submit_tag(options = {}) ⇒ String #submit_tag(caption, options = {}) ⇒ String
Constructs a submit button from the given options.
#telephone_field_tag(name, options = {}) ⇒ String Also known as: phone_field_tag
Creates a telephone field input with the given name and options.
telephone_field_tag :cell_phone, :tabindex => 1 telephone_field_tag :work_phone, :tabindex => 2 telephone_field_tag :home_phone, :tabindex => 3 # => <input name="cell_phone" tabindex="1" type="tel" /> # => <input name="work_phone" tabindex="2" type="tel" /> # => <input name="home_phone" tabindex="3" type="tel" />
#text_area_tag(name, options = {}) ⇒ Object
Constructs a text area input from the given options.
#text_field_tag(name, options = {}) ⇒ String
Creates a text field input with the given name and options.
#time_field_tag(name, options = {}) ⇒ String
Constructs a time tag from the given options.
#url_field_tag(name, options = {}) ⇒ String
Creates a URL field input with the given name and options.
#week_field_tag(name, options = {}) ⇒ String
Constructs a week tag from the given options.
© 2010–2016 Padrino
Licensed under the MIT License.
http://www.rubydoc.info/github/padrino/padrino-framework/Padrino/Helpers/FormHelpers