What I want to do is to make the click me
action button disappear once it is clicked and the input is not empty or null. Here I am using conditionalPanel
to achieve my goal.
Here is my demo code, but the click me
button disappers even when the input is empty.
How can I modify my code?
Thanks a lot.
library(shiny)
ui <- fluidPage(
textInput(inputId = "myInput", label = "Write something"),
conditionalPanel(
condition = "input.click === 0 || input.myInput == null",
actionButton(inputId = "click", label = "click me")
),
conditionalPanel(
condition = "input.click !== 0 && input.myInput !== null && input.myInput !== ''",
style = "display: none;"
),
verbatimTextOutput("text")
)
server <- function(input, output) {
Value <- eventReactive(input$click, {
input$myInput
})
output$text <- renderPrint({
Value()
})
}
shinyApp(ui, server)