Hello guys, I'm currently training to build a shiny app.
I want to make a value box, the value is based on text input, and its updating after click action button
I use this script:
shinyApp(
ui <- dashboardPage(
dashboardHeader(
title = "Test action button"
),
dashboardSidebar(),
dashboardBody(
fluidRow(
box(
textInput(
"unicode",
"Your Unique ID:",
placeholder = "Input your unique ID here"
),
actionButton(
"actbtn_unicode",
"Submit"
),
width = 8
),
valueBoxOutput(
"vbox_unicode"
)
),
)
),
server <- function(input, output){
update_unicode <- eventReactive(input$act_unicode,{
input$unicode
})
output$vbox_unicode <- renderValueBox({
valueBox(
update_unicode,
"Your Unique ID",
icon = icon("fingerprint")
)
})
}
)
And it shows error:
Warning: Error in as.vector: cannot coerce type 'closure' to vector of type 'character'
[No stack trace available]
I also try using numericInput
instead of textInput
and error still appear.
Can anyone tell me how to do it correctly?