Class: UrlField

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

Instance Method Summary collapse

Methods inherited from BasicField

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

Methods included from Helpers

#tag, #tag_attributes, #tag_content

Constructor Details

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

Returns a new instance of UrlField.



87
88
89
90
91
92
# File 'lib/formalize/field.rb', line 87

def initialize(id, opts={})
  super
  @opts[:type] = :url
  # REVIEW: The HTML this renders isn't great. Maybe only apply this on post?
  @opts[:pattern] ||= /^#{URI::regexp(['http', 'https'])}$/
end