diff options
author | Ray Baxter <ray.baxter@gmail.com> | 2011-07-17 12:51:03 -0700 |
---|---|---|
committer | Ray Baxter <ray.baxter@gmail.com> | 2011-07-17 13:08:02 -0700 |
commit | 65b19c36333cd7220402a1cdcae0c82e462e913e (patch) | |
tree | 92777af5887cfec3f5085800490828bef421a947 /actionpack/lib/action_view/helpers | |
parent | a4a309f2bc131d7782b3ddf9964c245398951f94 (diff) | |
download | rails-65b19c36333cd7220402a1cdcae0c82e462e913e.tar.gz rails-65b19c36333cd7220402a1cdcae0c82e462e913e.tar.bz2 rails-65b19c36333cd7220402a1cdcae0c82e462e913e.zip |
document options to search_field
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 3a430abcdf..f18531af97 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -859,7 +859,28 @@ module ActionView InstanceTag.new(object_name, method, self, options.delete(:object)).to_radio_button_tag(tag_value, options) end - # Returns a text_field of type "search". + # Returns an input of type "search" for accessing a specified attribute (identified by +method+) on an object + # assigned to the template (identified by +object+). Inputs of type "search" may be styled differently by + # some browsers + # + # ==== Examples + # + # search_field(:user, :name) + # # => <input id="user_name" name="user[name]" size="30" type="search" /> + # search_field(:user, :name, :autosave => false) + # # => <input autosave="false" id="user_name" name="user[name]" size="30" type="search" /> + # search_field(:user, :name, :results => 3) + # # => <input id="user_name" name="user[name]" results="3" size="30" type="search" /> + # # Assume request.host returns "www.example.com" + # search_field(:user, :name, :autosave => true) + # # => <input autosave="com.example.www" id="user_name" name="user[name]" results="10" size="30" type="search" /> + # search_field(:user, :name, :onsearch => true) + # # => <input id="user_name" incremental="true" name="user[name]" onsearch="true" size="30" type="search" /> + # search_field(:user, :name, :autosave => false, :onsearch => true) + # # => <input autosave="false" id="user_name" incremental="true" name="user[name]" onsearch="true" size="30" type="search" /> + # search_field(:user, :name, :autosave => true, :onsearch => true) + # # => <input autosave="com.example.www" id="user_name" incremental="true" name="user[name]" onsearch="true" results="10" size="30" type="search" /> + def search_field(object_name, method, options = {}) options = options.stringify_keys |