Class: Aurita::GUI::Hidden_Field

Inherits:
Form_Field show all
Defined in:
lib/aurita-gui/form/hidden_field.rb

Overview

Usage:

i = Hidden_Field.new(:name => :description, 
                     :label => 'Description', 
                     :value => 'Lorem ipsum dolor')

Tag attributes like onclick, onchange, class etc. can be set, but will either be ignored or have no effect.

Instance Attribute Summary

Attributes inherited from Form_Field

#form, #label, #type, #value

Attributes inherited from Element

#attrib, #content, #parent, #tag, #type

Instance Method Summary collapse

Methods inherited from Form_Field

#disable!, #editable!, #enable!, #readonly!, #readonly?, #to_s

Methods inherited from Element

#+, #[], #[]=, #clear_floating, #dom_id, #dom_id=, #each, #empty?, #id, #id=, #length, #method_missing, #string, #to_ary

Constructor Details

#initialize(params, &block) ⇒ Hidden_Field

Returns a new instance of Hidden_Field.



18
19
20
21
22
23
24
25
# File 'lib/aurita-gui/form/hidden_field.rb', line 18

def initialize(params, &block)
  params[:tag]  = :input
  params[:type] = :hidden
  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

#elementObject



26
27
28
# File 'lib/aurita-gui/form/hidden_field.rb', line 26

def element
  HTML.input(@attrib)
end

#readonly_elementObject



29
30
31
# File 'lib/aurita-gui/form/hidden_field.rb', line 29

def readonly_element
  element()
end