diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-19 13:09:09 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-19 13:09:09 +0000 |
commit | ad1fe7dd277e4e82bd8588e06c1181b6f8402683 (patch) | |
tree | 556a21fdcc4099bcc65314092f55098d1670de67 /actionpack/lib/action_view/helpers | |
parent | 967339e4d324daa659e5f625d48a56dc17d5287e (diff) | |
download | rails-ad1fe7dd277e4e82bd8588e06c1181b6f8402683.tar.gz rails-ad1fe7dd277e4e82bd8588e06c1181b6f8402683.tar.bz2 rails-ad1fe7dd277e4e82bd8588e06c1181b6f8402683.zip |
Completed FormTagHelper by adding radio_button_tag and select_tag
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@688 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_tag_helper.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index ba5fc39537..78123a9d87 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -31,12 +31,20 @@ module ActionView "</form>" end + def select_tag(name, option_tags = nil, options = {}) + content_tag("select", option_tags, { "name" => name, "id" => name }.update(options)) + end + def text_field_tag(name, value = nil, options = {}) tag("input", {"type" => "text", "name" => name, "id" => name, "value" => value}.update(options)) end + def hidden_field_tag(name, value = nil, options = {}) + text_field_tag(name, value, options.update("type" => "hidden")) + end + def password_field_tag(name = "password", value = nil, options = {}) - tag("input", {"type" => "password", "name" => name, "id" => name, "value" => value}.update(options)) + text_field_tag(name, value, options.update("type" => "password")) end def text_area_tag(name, content = nil, options = {}) @@ -54,6 +62,12 @@ module ActionView tag("input", html_options) end + def radio_button_tag(name, value, checked = false, options = {}) + html_options = {"type" => "radio", "name" => name, "id" => name, "value" => value}.update(options) + html_options["checked"] = "checked" if checked + tag("input", html_options) + end + def submit_tag(value = "Save changes", options = {}) tag("input", {"type" => "submit", "name" => "submit", "value" => value}.update(options)) end |