name: name of the element in the HTML form. This argument is mandatory and should be unique in the form.
value: optional, value that will be pre-populated in the text field and/or the caption of the button.
size: optional, size of the element. For text input the number of visible characters, for selection the number of visible items.
type: type of the element. Valid entries are "text", "password", "button", "checkbox", "radio", "file", "hidden", "image", "reset" and "submit".
checked: boolean, if set to TRUE then the checked
attribute is set in the element (valid for checkboxes only).
text: character vector of the items that will be shown to the user.
values: values that will represent the text items in the form and thus submitted. Typically IDs are used here instead of the actual text to avoid issues with encoding and size.
sel.index: index (integer or a logical vector) specifying which value will be selected. If missing, none will be marked as selected.
sel.value: value (one of the values elements) which will be selected. Only one of sel.index and set.value may be specified.
...: Additional HTML attributes and their values. The actual range of supported attibutes is browser- and element-specific. Some commonly supported attributes include disabled (must be boolean), class, id, style, onChange, onClick, onSelect, onFocus, onBlur. It is possible to pass objects as long as they implement as.character method to generate valid values that can be used in the item="value" form, i.e. assuming double quotes around the value in HTML.
Returns
The functions are called for their side-effect (see out). They return the current HTML buffer.
Author(s)
Simon Urbanek
Note
All form-level functions assume the existence of an enclosing form. The actual behavior (other than custom JavaScript callback attributes) is defined by the enclosing form.
See Also
out, oprint, done
Examples
run <-function(foo, fruit,...){ fruits <- c("apples","oranges","pears")if(!missing(fruit)) out("Thank you for choosing ", fruits[as.integer(fruit)],"!<p>") out("<form>") out("Foo:") oinput("foo", foo) out("<br>Select fruit:") oselection("fruit", fruits, seq.int(fruits),, fruit) out("<br>") osubmit() out("</form>") done()}