Validators are used to validate input fields in a ShinyForm. Validators are to be used with the validatedInput function. A single input field can have several validators.
Package shinyreformss defines a set of commonly used pre-defined Validators. These include:
Will fail if string is shorter than minLength.
Will fail if string is longer than maxLength.
Will fail if string is empty.
test
Function returning a boolean value which will be used to validate input.
failMessage
Error message to display when validation fails.
new()
Creates a Validator object.
Validator$new(test, failMessage)
test
A function to test the input. Should take a single value as input and return a boolean.
failMessage
A fail message to be displayed.
check()
Performs a check on the input.
Validator$check(value)
value
Input value to be tested.
TRUE if the check passes, FALSE if otherwise.
clone()
The objects of this class are cloneable with this method.
Validator$clone(deep = FALSE)
deep
Whether to make a deep clone.