Class: TextareaField

Inherits:
BasicField show all
Defined in:
lib/formalize/field.rb

Instance Method Summary collapse

Methods inherited from BasicField

#errors, #errors=, #valid?, #validate, #validate_format, #validate_length, #validate_presence, #value, #value=

Methods included from Helpers

#tag, #tag_attributes, #tag_content

Constructor Details

#initialize(id, opts = {}) ⇒ TextareaField

Returns a new instance of TextareaField.



96
97
98
99
# File 'lib/formalize/field.rb', line 96

def initialize(id, opts={})
  super
  @opts[:type] = :textarea
end

Instance Method Details

#input(attrs = @opts) ⇒ Object



100
101
102
103
104
# File 'lib/formalize/field.rb', line 100

def input(attrs = @opts)
  value = attrs.delete(:value)
  input = tag_content(:textarea, value, attrs)
  attrs[:label] ? tag_content(:label, "#{ attrs[:label] } #{ input }") : input
end