From ffd93a84ff345192db71704572bada99e63f161b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 8 Dec 2004 10:50:59 +0000 Subject: Fixed to_input_field_tag so it no longer explicitly uses InstanceTag.value if value was specified in the options hash [evl] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@81 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/form_helper.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 389aa302a9..f64965bda1 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -117,7 +117,9 @@ module ActionView def to_input_field_tag(field_type, options = {}) html_options = DEFAULT_FIELD_OPTIONS.merge(options) html_options.merge!({ "size" => options["maxlength"]}) if options["maxlength"] && !options["size"] - html_options.merge!({ "type" => field_type, "value" => value.to_s }) + html_options.delete("size") if field_type == "hidden" + html_options.merge!({ "type" => field_type}) + html_options.merge!({ "value" => value.to_s }) unless options["value"] add_default_name_and_id(html_options) tag("input", html_options) end @@ -179,4 +181,4 @@ module ActionView end end end -end \ No newline at end of file +end -- cgit v1.2.3