Class: Aurita::GUI::Input_Field
- Inherits:
-
Form_Field
- Object
- Array
- Element
- Form_Field
- Aurita::GUI::Input_Field
- Defined in:
- lib/aurita-gui/form/input_field.rb
Overview
Factory for input fields. Default type is :text, accoring to W3C, possible types are :password, :radio, :checkbox.
For radio and checkbox input fields, there are classes Radio_Field and Checkbox_Field, providing more convenience than building option fields manually. See also Options_Field on this topic.
Usage:
i = Input_Field.new(:type => :text,
:name => :description,
:label => 'Enter a discription',
:value => 'Lorem ipsum dolor')
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Form_Field
#data_type, #form, #hidden, #hint, #invalid, #label, #required, #type, #value
Attributes inherited from Element
#attrib, #force_closing_tag, #gui_element_id, #parent, #tag
Instance Method Summary collapse
- #element ⇒ Object
-
#initialize(params, &block) ⇒ Input_Field
constructor
A new instance of Input_Field.
Methods inherited from Form_Field
#disable!, #disabled=, #editable!, #enable!, #hidden?, #hide!, #invalid!, #invalid?, #optional!, #readonly!, #readonly=, #readonly?, #readonly_element, #required!, #required?, #show!, #to_hidden_field, #to_s
Methods inherited from Element
#+, #<<, #[], #[]=, #add_class, #aurita_gui_element, #clear_floating, #css_classes, #find_by_dom_id, #get_content, #has_content?, #id, #id=, #inspect, #js_init_code, #length, #method_missing, #recurse, #remove_class, #set_content, #string, #swap, #to_ary, #touch, #touched?, #type=, #untouch
Methods included from Marshal_Helper_Class_Methods
Methods included from Marshal_Helper
Constructor Details
#initialize(params, &block) ⇒ Input_Field
Returns a new instance of Input_Field.
25 26 27 28 29 30 31 32 |
# File 'lib/aurita-gui/form/input_field.rb', line 25 def initialize(params, &block) params[:tag] = :input params[:type] = :text unless params[:type] if block_given? then params[:value] = yield end super(params) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Aurita::GUI::Element
Instance Method Details
#element ⇒ Object
33 34 35 36 |
# File 'lib/aurita-gui/form/input_field.rb', line 33 def element @attrib[:value] = @value HTML.input(@attrib) end |