| sv_lte | R Documentation |
The sv_lte() function compares the field value to a specified value with
the <= operator.
sv_lte(
rhs,
message_fmt = "Must be less than or equal to {rhs}.",
allow_multiple = FALSE,
allow_na = FALSE,
allow_nan = FALSE,
allow_inf = FALSE
)
rhs |
The right hand side (RHS) value is to be used for the comparison
with the field value. The validation check will effectively be of the form
|
message_fmt |
The validation error message to use if the field fails the
validation test. Use the |
allow_multiple |
If |
allow_na, allow_nan |
If |
allow_inf |
If |
A function suitable for use as an
InputValidator$add_rule() rule.
The other comparison-based rule functions: sv_gt(), sv_gte(),
sv_lt(), sv_equal(), and sv_not_equal(). The sv_lt() function may
be needed if the field value should not pass validation when it is equal to
the comparison value.
Other rule functions:
compose_rules(),
sv_between(),
sv_email(),
sv_equal(),
sv_gte(),
sv_gt(),
sv_in_set(),
sv_integer(),
sv_lt(),
sv_not_equal(),
sv_numeric(),
sv_optional(),
sv_regex(),
sv_required(),
sv_url()
## Only run examples in interactive R sessions
if (interactive()) {
library(shiny)
library(shinyvalidate)
ui <- fluidPage(
textInput("number", "Number")
)
server <- function(input, output, session) {
# Validation rules are set in the server, start by
# making a new instance of an `InputValidator()`
iv <- InputValidator$new()
# Basic usage: `sv_lte()` requires a value
# to compare against the field value; a message
# will be shown if the validation of
# `input$number` fails
iv$add_rule("number", sv_lte(0))
# Finally, `enable()` the validation rules
iv$enable()
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.