Learn R Programming

shinyreforms (version 0.0.1)

validatedInput: Add validator to a Shiny input.

Description

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

Usage

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

Run this code
# NOT RUN {
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)
  )
)
# }

Run the code above in your browser using DataLab