When running the app, you will see that Option 1 is already selected, however it is strange because in ui I inserted selected="No option selected". So what am I doing wrong?
My idea is that when running the algorithm, there is no option selected in selectInput.
shiny numericInput does not support this at present. but it would be an easy extension, it might be done like this. I may offer this to the shiny project as a small feature enhancement, because it seems potentially useful.
library(shiny)
mynumericInput <- function (inputId, label, value, min = NA, max = NA, step = NA,
width = NULL,placeholder=NA_character_)
{
value <- shiny:::restoreInput(id = inputId, default = value)
inputTag <- tags$input(id = inputId, type = "number",
class = "form-control", value = shiny:::formatNoSci(value))
if (!is.na(min))
inputTag$attribs$min = min
if (!is.na(max))
inputTag$attribs$max = max
if (!is.na(step))
inputTag$attribs$step = step
if (!is.na(placeholder))
inputTag$attribs$placeholder = placeholder
div(class = "form-group shiny-input-container", style = htmltools:::css(width = htmltools:::validateCssUnit(width)),
shiny:::shinyInputLabel(inputId, label), inputTag)
}
ui <- fluidPage(
numericInput("num1", label = h5("Numeric input 1"), min = 0, max = 1, value = NA, step = 0.1),
mynumericInput("num2", label = h5("Numeric input 2"), min = 0, max = 1, value = NA, step = 0.1,placeholder = "test")
)
server <- function(input, output, session) {
}
shinyApp(ui, server)