Open Aspirational-Human opened 1 month ago
Hello,
shinyFeedback's support for autonumericInput()
is available in the dev version, install package from GitHub and it will work:
remotes::install_github("merlinoa/shinyFeedback")
For an immediate CRAN available solution, you can try package shinyvalidate:
library(shiny)
library(bslib)
library(shinyvalidate)
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
)
)
)
server <- function(input, output, session) {
# 1. Create an InputValidator object
iv <- InputValidator$new()
# 2. Add validation rules
iv$add_rule("text_input", sv_required())
iv$add_rule("numeric_input", sv_required())
iv$add_rule("autonumeric_input", sv_required())
# 3. Start displaying errors in the UI
iv$enable()
}
shinyApp(ui, server)
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.