How to display the conditinal panel GUI iteratively everytime the condition is true?


#1

Hi,

Below is my module's server function. It displays a selectInputGUI that displays a list of files. The user has to select more than 1. If the user only selects 1 then the selectInput gui of the conditional panel is displayed. This function works, but it works only once. In other words, if the user only selects 1 file through the first selectInput, the conditional panel displays, but If the user selects only 1 file again, the conditional panel does not execute again. How can I make the conditional panel iterative so that if the user selects only one file again, the conditional panel executes again. I would like for the conditional panel to execute until the user has entered more than 1 file. Thanks.

firstServer <- function(input, output, session, a) {
  ns = session$ns
  
  output$first <- renderUI({
    tagList(
    #  selectInput(ns("select"), h4("Select"), paste0(isolate(a()), letters[1:4]))
    selectInput(ns("select"), h5(strong("PLEASE CHOSE FILES TO COMBINE. To undo selection select the selected file again and press delete")),c(Choose='', list.files("~/Folder1/folder2/folder3/DATA")), multiple=TRUE, selectize=TRUE),
    conditionalPanel(sprintf("input['%s'].length == '1'", ns("select")),
                     selectInput("select",label = h5(strong("Must select more than one data set. Try again.. To undo selection select the selected file again and press delete")),c(Choose='', list.files("~/Foldere1/folder2/folder3/DATA")), multiple=TRUE, selectize=TRUE)
                     )
   )
    
})

  returnedValue <- (reactive({ paste0(input$select) }))
  
  #return(reactive({ paste0(input$select) }))
  return(returnedValue)
}