class Ezframe::TextType

Public Instance Methods

db_type() click to toggle source
# File lib/ezframe/column_type.rb, line 141
def db_type
  return "text"
end
form(opts = {}) click to toggle source
# File lib/ezframe/column_type.rb, line 131
def form(opts = {})
  return nil if no_edit? && !opts[:force]
  key = self.key
  key ="#{key}#{opts[:key_suffix]}" if opts[:key_suffix]
  h = Ht.input(type: "text", name: key, label: @attribute[:label], value: @value || "")
  h[:class] = @attribute[:class] if @attribute[:class]
  h[:after]  = make_error_box(key)
  return h
end
normalize(val) click to toggle source
# File lib/ezframe/column_type.rb, line 118
def normalize(val)
  return nil unless val
  val = val.dup.to_s
  val.gsub!(/ /, " ")
  # val.gsub!(/\s+/, " ")
  val.strip!
  return val
end
value=(val) click to toggle source
# File lib/ezframe/column_type.rb, line 127
def value=(val)
  @value = normalize(val)
end