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 })
}
)
}
Run the code above in your browser using DataLab