| ShinyForm {shinyreforms} | R Documentation |
Class representing a ShinyForm form.
Description
ShinyForm can be used to include forms in your website. Create
a ShinyForm object anywhere in your application by
defining all the inputs (possibly adding validators) and by
specifying callback onSuccess and onError functions.
Details
Parameters onSuccess and onError passed to the constructor
should be functions with signatures function(self, input, output),
where 'self' will refer to the form itself, while input and
output will be the usual Shiny objects.
Public fields
idUnique form id which can be used with Shiny input.
elementsA list of ShinyForm input elements.
onSuccessA function with to be run on valid submission, see details.
onErrorA function with to be run on invalid submission, see details.
submitA submit Action button/link.
Methods
Public methods
Method new()
Initialises a ShinyForm.
Usage
ShinyForm$new(id, submit, onSuccess, onError, ...)
Arguments
idUnique form identifier.
submitSubmit button label.
onSuccessFunction to be ran on successful validation.
onErrorFunction to be ran on unsuccesful validation.
...A list of validated Shiny inputs.
Method ui()
Returns the form's UI. To be used inside your App's UI.
Usage
ShinyForm$ui()
Method server()
Form logic. To be inserted into your App's server function.
Will validate form upon hitting the "Submit" button and run the 'onSuccess' or 'onError' function depending on whether the form is valid.
Usage
ShinyForm$server(input, output)
Arguments
inputShiny input.
outputShiny output.
Method getValue()
Returns value of the input element with a given ID.
Usage
ShinyForm$getValue(input, inputId)
Arguments
inputShiny input.
inputIdID of the input whose value is to be returned.
Method clone()
The objects of this class are cloneable with this method.
Usage
ShinyForm$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.