Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
CGI::HtmlExtension#submit
submit(value = nil, name = nil)
lib/cgi/html.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/lib/cgi/html.rb, line 750
def submit(value = nil, name = nil)
attributes = if (not value) or value.kind_of?(String)
{ "TYPE" => "submit", "VALUE" => value, "NAME" => name }
else
value["TYPE"] = "submit"
value
end
input(attributes)
end
Generate a submit button Input element, as a String.
value is the text to display on the button. name is the name of the input.
Alternatively, the attributes can be specified as a hash.
Example
submit # <INPUT TYPE="submit"> submit("ok") # <INPUT TYPE="submit" VALUE="ok"> submit("ok", "button1") # <INPUT TYPE="submit" VALUE="ok" NAME="button1"> submit("VALUE" => "ok", "NAME" => "button1", "ID" => "foo") # <INPUT TYPE="submit" VALUE="ok" NAME="button1" ID="foo">