validatedInput {shinyreforms}R Documentation

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.

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

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)
  )
)

[Package shinyreforms version 0.0.1 Index]