Class: Formulary::HtmlForm::Fields::Input
- Inherits:
-
Field
- Object
- Field
- Formulary::HtmlForm::Fields::Input
show all
- Defined in:
- lib/formulary/html_form/fields/input.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Field
#get_value_from_data_field, #initialize, #is_hidden?, #label, #name, #set_value
Class Method Details
.compatible_with?(element) ⇒ Boolean
3
4
5
6
|
# File 'lib/formulary/html_form/fields/input.rb', line 3
def self.compatible_with?(element)
element.name == "input" &&
element.attributes["type"].value == compatible_type
end
|
.supports_required? ⇒ Boolean
8
9
10
|
# File 'lib/formulary/html_form/fields/input.rb', line 8
def self.supports_required?
true
end
|
Instance Method Details
#error ⇒ Object
16
17
18
19
|
# File 'lib/formulary/html_form/fields/input.rb', line 16
def error
return super if super.present?
return "'#{label}' does not match the expected format" unless pattern_correct?
end
|
#valid? ⇒ Boolean
12
13
14
|
# File 'lib/formulary/html_form/fields/input.rb', line 12
def valid?
super && pattern_correct?
end
|