validatedInput: Add validator to a Shiny input.

Description Usage Arguments Details Value Examples

View source: R/validated_input.R

Description

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

Usage

1
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.

Details

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

Value

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

Examples

1
2
3
4
5
6
7
8
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)
  )
)

shinyreforms documentation built on July 2, 2020, 1:33 a.m.