A validation function, suitable for use with InputValidator$add_rule()
, that checks whether an input value looks like a valid email address.
sv_email(
message = "Not a valid email address",
allow_multiple = FALSE,
allow_na = FALSE
)
Arguments
The validation error message to use if a value doesn't match a regex pattern for email address detection.
If FALSE
(the default), then the length of the input vector must be exactly one; if TRUE
, then any length is allowed (including a length of zero; use sv_required()
if one or more values should be required).
If FALSE
, then any NA
element will cause validation to fail.
The sv_url()
function, another specialized regex-based function for validating URLs. For general regex-based validation the sv_regex()
function is useful.
Other rule functions: compose_rules()
, sv_between()
, sv_equal()
, sv_gte()
, sv_gt()
, sv_in_set()
, sv_integer()
, sv_lte()
, 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("email", "Email")
)
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_email()` works well with its
# defaults; a message will be displayed if the
# validation of `input$email` fails
iv$add_rule("email", sv_email())
# Finally, `enable()` the validation rules
iv$enable()
}
shinyApp(ui, server)
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4