1
一个例子的代码:如何在R闪亮的UI元素附近打印错误消息?
ui.R
library(shiny)
shinyUI(
fluidRow(column(2, actionButton("add", "ADD details")),
fluidRow(uiOutput("ui"))
)
)
server.R
shinyServer(function(input, output,session){
observeEvent(
input$add,
output$ui <- renderUI({
isolate({
fluidRow(column(4, textInput("birthweight", label = "birth weight:", value = '')),
column(3, numericInput("height",label = "Height:",value='')),
column(2, actionButton("addnew", "ADD details to database"))
)
})
})
)
})
当用户输入的输入birthweight
应显示附近,如果它的textInput
盒的错误消息包含字符数据,类似于numericInput
Height
。用户输入数据后,或者用户单击数据库操作按钮的添加详细信息时,必须立即显示该信息,但应该显示为文本框附近的错误消息,而不是弹出窗口。
这可以在R闪亮吗?
您是否尝试过的http:/ /shiny.rstudio.com/articles/validation.html? –