radio_button

radio_button(name = "", value = nil, checked = nil) Instance Public methods Generates a radio-button Input element. name is the name of the input field. value is the value of the field if checked. checked specifies whether the field starts off checked. Alternatively, the attributes can be specified as a hash. radio_button("name", "value") # <INPUT TYPE="radio" NAME="name" VALUE="value"> radio_button("name", "value", true) # <INPUT TYPE="radio" NAME="name" VALUE="val

popup_menu

popup_menu(name = "", *values) Instance Public methods Generate a Select element as a string. name is the name of the element. The values are the options that can be selected from the Select menu. Each value can be a String or a one, two, or three-element Array. If a String or a one-element Array, this is both the value of that option and the text displayed for it. If a three-element Array, the elements are the option value, displayed text, and a boolean value specifying whether

password_field

password_field(name = "", value = nil, size = 40, maxlength = nil) Instance Public methods Generate a Password Input element as a string. name is the name of the input field. value is its default value. size is the size of the input field display. maxlength is the maximum length of the inputted password. Alternatively, attributes can be specified as a hash. password_field("name") # <INPUT TYPE="password" NAME="name" SIZE="40"> password_field("name", "value") # <INP

multipart_form

multipart_form(action = nil, enctype = "multipart/form-data") Instance Public methods Generate a Form element with multipart encoding as a String. Multipart encoding is used for forms that include file uploads. action is the action to perform. enctype is the encoding type, which defaults to âmultipart/form-dataâ. Alternatively, the attributes can be specified as a hash. multipart_form{ "string" } # <FORM METHOD="post" ENCTYPE="multipart/form-data">string</FORM> mult

img

img(src = "", alt = "", width = nil, height = nil) Instance Public methods Generate an Image element as a string. src is the URL of the image. alt is the alternative text for the image. width is the width of the image, and height is its height. Alternatively, the attributes can be specified as a hash. img("src", "alt", 100, 50) # <IMG SRC="src" ALT="alt" WIDTH="100" HEIGHT="50"> img("SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50) # <IMG S

image_button

image_button(src = "", name = nil, alt = nil) Instance Public methods Generate an Image Button Input element as a string. src is the URL of the image to use for the button. name is the input name. alt is the alternative text for the image. Alternatively, the attributes can be specified as a hash. image_button("url") # <INPUT TYPE="image" SRC="url"> image_button("url", "name", "string") # <INPUT TYPE="image" SRC="url" NAME="name" ALT="string"> image_button("SRC"

html

html(attributes = {}) Instance Public methods Generate a top-level HTML element as a string. The attributes of the element are specified as a hash. The pseudo-attribute âPRETTYâ can be used to specify that the generated HTML string should be indented. âPRETTYâ can also be specified as a string as the sole argument to this method. The pseudo-attribute âDOCTYPEâ, if given, is used as the leading DOCTYPE SGML tag; it should include the entire text of this tag, including angle brack

hidden

hidden(name = "", value = nil) Instance Public methods Generate a Hidden Input element as a string. The attributes of the element can be specified as two arguments, name and value. Alternatively, the attributes can be specified as a hash. hidden("name") # <INPUT TYPE="hidden" NAME="name"> hidden("name", "value") # <INPUT TYPE="hidden" NAME="name" VALUE="value"> hidden("NAME" => "name", "VALUE" => "reset", "ID" => "foo") # <INPUT TYPE="hidden" NAME="n

form

form(method = "post", action = script_name, enctype = "application/x-www-form-urlencoded") Instance Public methods Generate a Form element as a string. method should be either âgetâ or âpostâ, and defaults to the latter. action defaults to the current CGI script name. enctype defaults to âapplication/x-www-form-urlencodedâ. Alternatively, the attributes can be specified as a hash. See also multipart_form() for forms that include file uploads. form{ "string" } # <FORM METHOD="

file_field

file_field(name = "", size = 20, maxlength = nil) Instance Public methods Generate an File Upload Input element as a string. The attributes of the element can be specified as three arguments, name, size, and maxlength. maxlength is the maximum length of the file's name, not of the file's contents. Alternatively, the attributes can be specified as a hash. See multipart_form() for forms that include file uploads. file_field("name") # <INPUT TYPE="file" NAME="name" SIZE="20">