1

Could anyone tell me which Javascript expression I should use as condition argument in a conditionalPanel function in the UI-side of a R Shiny App to test if a file has been uploaded ? I've tried several expressions (==0, ==true, .length, etc.), but haven't found anyone that works...

library(fullPage)
library(shiny)
library(shinyWidgets)

ui <- pagePiling(
  center = TRUE,
  sections.color = c("#CFE2F3"),
  menu = c(
 "Tab1" = "exploit"
  ),
  pageSection(
    
    fileInput("selectFile", "Choose a file",
              multiple = FALSE
    ),
    conditionalPanel(condition="##TEST IF FILE LOADED",
                     downloadButton('download_file',
                                    "Download the uploaded file"))
  )
)
server <- function(input, output){
}
shinyApp(ui, server)

Thanks in advance if you can help

NB: I know that I could achieve the same result by using uiOutput in the UI-side and then a test with input$selectFile in the server-side, but I would like to learn how to do it with a Javascript expression.

mazu
  • 147
  • 6
  • To make this easier reproducible you could drop the 'fullPage' dependency and use `fluidPage` instead of `pageSection`. Btw. 'fullPage' is not on CRAN. I was playing around and it seems like the `input.selectFile` doesn't exist on the JavaScript side. Interesting problem. – TimTeaFan Feb 24 '23 at 08:00

0 Answers0