Use to create shiny input tags with validation. This should only be used in ShinyForm constructor.

validatedInput(tag, helpText = NULL, validators = c())

Arguments

tag

Tag to be modified.

helpText

Tooltip text. If NULL, no tooltip will be added.

validators

A vector of `Validator` objects.

Value

A modified shiny input tag with attached validators and an optional tooltip div.

Details

The Shiny tag receives an additional attribute `validators` which is a vector of `Validator` objects.

Examples

shinyreforms::validatedInput( shiny::textInput("text_input", label = "Username"), helpText = "Username must have length between 4 and 12 characters.", validators = c( shinyreforms::ValidatorMinLength(4), shinyreforms::ValidatorMaxLength(12) ) )
#> <div class="form-group shiny-input-container"> #> <label class="control-label" for="text_input"> #> Username #> <div class="shinyreforms-tooltip"> #> <i class="glyphicon glyphicon-question-sign"></i> #> <div class="shinyreforms-tooltip-text">Username must have length between 4 and 12 characters.</div> #> </div> #> </label> #> <input id="text_input" type="text" class="form-control" value=""/> #> <div id="text_input-shinyreforms-validation" class="shiny-text-output text-danger"></div> #> </div>