validateF7Input | R Documentation |
validateF7Input
is a function to validate a given shinyMobile input.
validateF7Input(
inputId,
info = NULL,
pattern = NULL,
error = NULL,
session = shiny::getDefaultReactiveDomain()
)
inputId |
Input to validate. |
info |
Additional text to display below the input field. |
pattern |
Pattern for validation. Regex. |
error |
Error text. |
session |
Shiny session object. |
Only works for f7Text, f7Password, f7TextArea and f7Select. See more at https://framework7.io/docs/inputs.html.
if (interactive()) {
library(shiny)
library(shinyMobile)
shinyApp(
ui = f7Page(
title = "Validate inputs",
f7SingleLayout(
navbar = f7Navbar(title = "validateF7Input"),
f7Text(
inputId = "caption",
label = "Caption",
value = "Data Summary"
),
verbatimTextOutput("value"),
hr(),
f7Text(
inputId = "caption2",
label = "Enter a number",
value = 1
)
)
),
server = function(input, output, session) {
observe({
validateF7Input(inputId = "caption", info = "Whatever")
validateF7Input(
inputId = "caption2",
pattern = "[0-9]*",
error = "Only numbers please!"
)
})
output$value <- renderPrint({ input$caption })
}
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.