module CGI::HtmlExtension
def radio_button(name = "", value = nil, checked = nil)
radio_button("NAME" => "name", "VALUE" => "value", "ID" => "foo")
#
radio_button("name", "value", true)
#
radio_button("name", "value")
Alternatively, the attributes can be specified as a hash.
starts off checked.
the field if checked. +checked+ specifies whether the field
+name+ is the name of the input field. +value+ is the value of
Generates a radio-button Input element.
def radio_button(name = "", value = nil, checked = nil) attributes = if name.kind_of?(String) { "TYPE" => "radio", "NAME" => name, "VALUE" => value, "CHECKED" => checked } else name["TYPE"] = "radio" name end input(attributes) end