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, #make_error_box, #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
620 621 622 623 624 625 626 |
# File 'lib/ezframe/column_type.rb', line 620 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
628 629 630 631 632 633 634 635 636 637 |
# File 'lib/ezframe/column_type.rb', line 628 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 |