Display conditional panel if certain condition is met upon pressind button

In my app I have several inputs that select rows from a dataframe, as soon as the user presses the confirm button I want to check if the number of selected rows is sufficient (say more than 6 rows). If it is below, I want to make a conditional panel visible warning the user and prompting them to change the inputs such that enough rows are selected.

My idea was to use eventReactive to check if the number of rows is sufficient as soon as the confirm button is pressed. If the row number is not sufficient eventReactive returns TRUE to an output variable. This variable in turn determines if the conditional panel is shown. However the eventReactive does't seem to be triggered when pressing the confirm button.

Here is a minimal example.


##### Module UI function #####
cellLineSelectorUI <- function(id){
  # create a namespace function using the provided id
  ns <- NS(id)
        # input field
        textInput("user_text", label = "Enter some text:", placeholder = "Please enter some text."),
        actionBttn(inputId = ns("Confirm_selection"), 
                   label = "Click here to confirm your selection.",
                   color= "primary",
                   style= "bordered"),# submit button
        conditionalPanel("output.cls_smpl_validateselection", ns=ns,
                         p("Text must be longer than 6 letters."))
        p("The great emptiness.")

##### Module server function #####
cellLineSelector <- function(input, output, session){
  output.cls_smpl_validateselection <- eventReactive(input$Confirm_selection, {
    # test if the the input has the minimum required number of letters
    if (length(input$user_text)<7) {
    } else{
##### Main app #####
ui <- fluidPage(title="Test",
server <- function(input, output, session) {
  callModule(cellLineSelector, "test")

shinyApp(ui = ui, server = server)

Any thoughts and help is appreciated! If there is a much better way to achieve that, I'm happy to hear suggestions! Maybe there is a way to e.g. show the user constantly a warning message weather enough rows have been selected.
The only important thing is upon hitting the confirm button the requirement of the minimal number of rows (or in the minimal example the minimal number of letters) has to be met. I don't mind, whether to tell the user that after pressing the button and let them redo everything or whether constantly showing them if the requirement is met.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.