module CGI::HtmlExtension
def text_field(name = "", value = nil, size = 40, maxlength = nil)
text_field("NAME" => "name", "VALUE" => "value")
#
text_field("name", "value", 80, 200)
#
text_field("name", "value", 80)
#
text_field("name", "value")
#
text_field("name")
Alternatively, the attributes can be specified as a hash.
is the maximum length of input accepted.
value. +size+ is the size of the input area. +maxlength+
+name+ is the name of the input field. +value+ is its initial
Generate a text field Input element, as a String.
def text_field(name = "", value = nil, size = 40, maxlength = nil) attributes = if name.kind_of?(String) { "TYPE" => "text", "NAME" => name, "VALUE" => value, "SIZE" => size.to_s } else name["TYPE"] = "text" name end attributes["MAXLENGTH"] = maxlength.to_s if maxlength input(attributes) end