Class: Ezframe::TelType
- Defined in:
- lib/ezframe/column_type.rb
Instance Attribute Summary
Attributes inherited from TypeBase
Instance Method Summary collapse
Methods inherited from TextType
Methods inherited from TypeBase
#db_type, #db_value, #form, get_class, #initialize, #key, #label, #multi_inputs?, #no_edit?, #no_view?, #type, type_name, #use_view_format, #value, #value=, #view
Constructor Details
This class inherits a constructor from Ezframe::TypeBase
Instance Method Details
#normalize(val) ⇒ Object
584 585 586 587 588 589 590 |
# File 'lib/ezframe/column_type.rb', line 584 def normalize(val) return nil unless val val = super(val) val = val.tr("0-9", "0-9") # val = val.gsub(/\D+/, "") return val end |
#validate(val) ⇒ Object
592 593 594 595 596 597 598 599 600 601 |
# File 'lib/ezframe/column_type.rb', line 592 def validate(val) super(val) return @error if @error return nil if !val || val.strip.empty? unless /^0\d{9,10}$/ =~ val.to_s @error = :invalid_value return @error end return nil end |