aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_helper.rb
diff options
context:
space:
mode:
authorRay Baxter <ray.baxter@gmail.com>2011-07-17 13:10:17 -0700
committerRay Baxter <ray.baxter@gmail.com>2011-07-17 13:10:17 -0700
commit82569b38279f46885cc96c08ed1a047877fcbe8d (patch)
treeeea7b89494bf3d86eb1d48aad7432f53c15ae797 /actionpack/lib/action_view/helpers/form_helper.rb
parent65b19c36333cd7220402a1cdcae0c82e462e913e (diff)
downloadrails-82569b38279f46885cc96c08ed1a047877fcbe8d.tar.gz
rails-82569b38279f46885cc96c08ed1a047877fcbe8d.tar.bz2
rails-82569b38279f46885cc96c08ed1a047877fcbe8d.zip
examples for telephone_field, url_field and email_field
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index f18531af97..e730526163 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -899,17 +899,29 @@ module ActionView
end
# Returns a text_field of type "tel".
+ #
+ # telephone_field("user", "phone")
+ # # => <input id="user_phone" name="user[phone]" size="30" type="tel" />
+
def telephone_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("tel", options)
end
alias phone_field telephone_field
# Returns a text_field of type "url".
+ #
+ # url_field("user", "homepage")
+ # # => <input id="user_homepage" size="30" name="user[homepage]" type="url" />
+
def url_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("url", options)
end
# Returns a text_field of type "email".
+ #
+ # email_field("user", "address")
+ # # => <input id="user_address" size="30" name="user[address]" type="email" />
+
def email_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("email", options)
end