Skip to content

autonumericInput(): How do I distinguish between no input and input=0? #384

@SteveDonohoWB

Description

@SteveDonohoWB

When I check input$num for an autonumericInput with inputId = "num", the value is zero for no input and for input=0. How do I tell the difference? The output of the code below is 0 for both no input and 0.

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
shinyWidgets::autonumericInput(
inputId = "num",
label = "Enter a number:",
value = NA # I also tried NULL. Same result.
)
)

server <- function(input, output) {
observe({
print(input$num)
})
}

shinyApp(ui = ui, server = server)

Using shinyWidgets_0.6.0
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Amazon Linux 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions