oinput {FastRWeb} | R Documentation |
Functions aiding in creating HTML form elements.
Description
oinput
creates an input element (text input, button, checkbox,
file, hidden value, image, password, radio button or reset/submit
button)
oselection
creates a drop-down list of items
osubmit
is a convenience wrapper for
oinput(type='submit', ...)
to create a submit button
Usage
oinput(name, value, size, type="text", checked=FALSE, ...)
osubmit(name="submit", ...)
oselection(name, text, values = text, sel.index, sel.value, size, ...)
Arguments
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 |
checked |
boolean, if set to |
text |
character vector of the items that will be shown to the user. |
values |
values that will represent the |
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 |
... |
Additional HTML attributes and their values. The actual range of
supported attibutes is browser- and element-specific. Some commonly
supported attributes include |
Value
The functions are called for their side-effect (see
out
). They return the current HTML buffer.
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.
Author(s)
Simon Urbanek
See Also
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()
}