Im trying to create a condition on a push button so it only works when my input is not empty AND is numeric . My code partially works as the button starts in a disabled gets enables when an input is typed but even if the input is not numeric (ie. typing letters will enable the button)
UI SIDE
library(shinyjs)
ui <- tabItem(tabName = "principal1",
br(),
fluidRow(
column(2,
textInput(inputId = "documento1", "Ingrese el numero de documento", "")
),
column(2,
br(),
fluidRow(
actionButton("consulta_gobutton1",
label = "Procesar",
icon = icon("clipboard-check") ) )))
SERVER SIDE
observeEvent(input$consulta_gobutton1, {
documento1 <- input$documento1
###HERE IS MY CODE###
})
observe({
toggleState("consulta_gobutton1", input$documento1 != "" & is.numeric(as.numeric(input$documento1)) )
})
