input_provided {shinyvalidate} | R Documentation |
Check whether an input value has been provided
Description
This function takes an input value and uses heuristics to guess whether it
represents an "empty" input vs. one that the user has provided. This will
vary by input type; for example, a shiny::textInput()
is ""
when empty,
while a shiny::numericInput()
is NA
.
input_provided
returns TRUE
for all values except:
-
NULL
-
""
An empty atomic vector or list
An atomic vector that contains only missing (
NA
) valuesA character vector that contains only missing and/or
""
valuesAn object of class
"try-error"
A value that represents an unclicked
shiny::actionButton()
Usage
input_provided(val)
Arguments
val |
Values to test for availability in a Shiny context. |
Details
This function is based on shiny::isTruthy()
but tweaked here in
shinyvalidate to change the treatment of FALSE
values: isTruthy(FALSE)
returns FALSE
, but input_provided(FALSE)
returns TRUE
. This difference
is motivated by shiny::checkboxInput()
, where isTruthy()
answers the
question of "is the input present and checked" while input_provided
is
just "is the input present".
Value
A logical vector of length 1.