Hello,
Is there a way to display UI iteratively with user input? Below is the idea.
ui <- fluidPage(
selectInput("something", ..............)
verbatimTextOutput("thing")
)
server <- function(input, output){
output$thing <- renderPrint({
shinyjs::show("something")
)}
while(length(input$something) == 1){
shinyjs::show("something)
}
}
I have tried the code below and it works, but I cannot implement the same thing using a while loop.
ui <- fluidPage(
hidden(selectInput("filescombinemessage",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("~/Development/fileTest/folder3/DATA")), multiple=TRUE, selectize=TRUE)),
)
values <- reactiveValues(n = 0)
observeEvent(input$filescombinemessage,{
values$n <- length(input$filescombinemessage)
})
output$onlyOneSelected<- renderPrint({
if(!is.null(values$n)){
if(values$n == 1){
shinyjs::show("filescombinemessage")
}else{
shinyjs::hide("filescombinemessage")
}
}
})
This is with the implementation of a while loop
server<- function(input, output){
values <- reactiveValues(n = 0)
observeEvent(input$filescombine,{
values$n <- length(input$filescombine)
})
output$onlyOneSelected<- renderPrint({
if(!is.null(values$n)){
while(values$n == 1){
shinyjs::show("filescombinemessage")
}
}
})
}
The implementation with the loop does not work. I would like for the message to keep displaying as long as the user selects one item only