You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I greatly appreciate the autonumericInput function's ability to format numeric inputs as currency. However, no matter what condition I set, I cannot make this input compatible with shinyFeedback to alert users when they have left a particular field empty. See my example below showing how autonumericInput is uniquely incompatible with shinyFeedback.
library(shiny)
library(bslib)
library(shinyFeedback)
library(shinyWidgets)
ui <- page_fluid(
useShinyFeedback(),
card(
card_header("Input Form"),
textInput("text_input", "Text Input"),
numericInput("numeric_input", "Numeric Input", value = NA),
autonumericInput(
"autonumeric_input",
"Autonumeric Input",
value = NULL,
align = "right",
decimalPlaces = 2
),
actionButton("submit", "Submit")
)
)
server <- function(input, output, session) {
observeEvent(input$submit, {
# Check text input
if (is.null(input$text_input) || input$text_input == "") {
showFeedbackDanger("text_input", "Please enter some text")
} else {
hideFeedback("text_input")
}
# Check numeric input
if (is.na(input$numeric_input)) {
showFeedbackDanger("numeric_input", "Please enter a number")
} else {
hideFeedback("numeric_input")
}
# Check autonumeric input
if (is.null(input$autonumeric_input) || input$autonumeric_input == "" || is.na(input$autonumeric_input)) {
showFeedbackDanger("autonumeric_input", "Please enter a number")
} else {
hideFeedback("autonumeric_input")
}
})
}
shinyApp(ui, server)
The text was updated successfully, but these errors were encountered:
Hello,
I greatly appreciate the autonumericInput function's ability to format numeric inputs as currency. However, no matter what condition I set, I cannot make this input compatible with shinyFeedback to alert users when they have left a particular field empty. See my example below showing how autonumericInput is uniquely incompatible with shinyFeedback.
The text was updated successfully, but these errors were encountered: