module CGI::HtmlExtension

def password_field(name = "", value = nil, size = 40, maxlength = nil)

#
password_field("NAME" => "name", "VALUE" => "value")

#
password_field("password", "value", 80, 200)

#
password_field("name", "value")

#
password_field("name")

Alternatively, attributes can be specified as a hash.

is the maximum length of the inputted password.
value. +size+ is the size of the input field display. +maxlength+
+name+ is the name of the input field. +value+ is its default

Generate a Password Input element as a string.
def password_field(name = "", value = nil, size = 40, maxlength = nil)
  attributes = if name.kind_of?(String)
                 { "TYPE" => "password", "NAME" => name,
                   "VALUE" => value, "SIZE" => size.to_s }
               else
                 name["TYPE"] = "password"
                 name
               end
  attributes["MAXLENGTH"] = maxlength.to_s if maxlength
  input(attributes)
end