Skip to content

feedbackWarning() does not work with searchInput() #765

@ivan-adzhubey

Description

@ivan-adzhubey

The following example code below does not trigger any feedbackWarning() messages when the search query is submitted, regardless of the validation status of the query string. However, the same code works as expected after swapping searchInput() for textInput().

Software:
R version 4.5.3 (2026-03-11)

> packageVersion("shiny"); packageVersion("shinyWidgets"); packageVersion("shinyFeedback")
[1] ‘1.13.0’
[1] ‘0.9.1’
[1] ‘0.4.0’

library(shiny)
library(shinyWidgets)
library(shinyFeedback)

ui <- fluidPage(
  useShinyFeedback(),
  searchInput("mysearch", "Search:",
              btnSearch = icon("magnifying-glass"), btnReset = icon("xmark")),
  textOutput("mytext")
)

server <- function(input, output, session) {
  observeEvent(input$mysearch, {
    # Check condition: if search is empty
    warn <- nchar(input$mysearch) < 3 && nchar(input$mysearch) > 0

    feedbackWarning(
      inputId = "mysearch",
      show = warn,
      text = "Must be at least 3 characters"
    )
  })

  output$mytext <- renderText("Search results (dummy)")
}
shinyApp(ui, server)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions