module CGI::HtmlExtension
def checkbox(name = "", value = nil, checked = nil)
checkbox("name", "value", true)
# = checkbox("NAME" => "name", "VALUE" => "value")
checkbox("name", "value")
# = checkbox("NAME" => "name")
checkbox("name")
Alternatively, the attributes can be specified as a hash.
if true, the CHECKED attribute will be included in the element.
+name+, +value+, and +checked+. +checked+ is a boolean value;
The attributes of the element can be specified as three arguments,
Generate a Checkbox Input element as a string.
def checkbox(name = "", value = nil, checked = nil) attributes = if name.kind_of?(String) { "TYPE" => "checkbox", "NAME" => name, "VALUE" => value, "CHECKED" => checked } else name["TYPE"] = "checkbox" name end input(attributes) end