Let's say I have created 10 selectInput
dropdowns for a multi plot export and these selectInputs
are called "xaxis_1", "xaxis_2", ..... , "xaxis_10"
for a single 1 I can write:
if(!is.null(input$xaxis_1)) { .... do stuff }
to stop it running export when the user hasn't entered any name, and presses submit, to avoid crashes.
A bit more general you can check this:
if(!is.null(input[[paste('xaxis', i, sep = '_')]])) { ...}
how can you write it elegantly so that 1 line of code checks whether ANY of the 1:10 input[[...]] is empty, i.e. NULL?
The nr of inputs depends on how many plots the user wants to export per file, so all is build with lapply(1:input$nrofplots, function(i) { .... } renderUI
structure, and my if statement needs to have the same flexibility of 1:n
In a situation like below in the image, pressing Initiate export
should give a sweetalert
(got that covered) saying there is at least 1 value missing