goal: depending on the input number (if else loop), different feedback message should be displayed. Possible duplicate of #55
error: after input change, feedback message is not updated
min working example to reproduce error: below.
library(shiny)
library(shinyFeedback)
# Module ui.R
expt.design.ui <- function(id) {
ns <- NS(id)
tagList(
useShinyFeedback(),
numericInput(ns("numSamples"), "How many samples in this experiment ?", value = 12)
)
}
# Module server.R
expt.design.server <- function(input, output, session) {
observeEvent(input$numSamples, {
req(input$numSamples)
if(is.numeric(input$numSamples)){
if (input$numSamples > 100) {
showFeedbackDanger(inputId = "numSamples", text = "too many..")
} else if(input$numSamples <= 4) {
showFeedbackWarning(inputId = "numSamples", text = "too less!")
} else if(input$numSamples <= 100) {
showFeedbackSuccess(inputId = "numSamples", text = "all good!")
} else {
hideFeedback("numSamples")
}
} else {
showFeedbackDanger(inputId = "numSamples", text = "should be number!")
}
})
}
ui <- fluidPage(
expt.design.ui(id = "numberFoo")
)
server <- function(input, output) {
callModule(module = expt.design.server, id = "numberFoo")
}
shinyApp(ui, server)
@nara3m This issue has been resolved in the most recent development version, which can be installed with remotes::install_github('merlinoa/shinyFeedback')
goal: depending on the input number (if else loop), different feedback message should be displayed. Possible duplicate of #55 error: after input change, feedback message is not updated min working example to reproduce error: below.