shinyUI(fluidPage( numericInput('value', 'Value',NULL, min = 0), textOutput("result"), submitButton("Calculate")))shinyServer(function(input, output, session) { react <- reactiveValues() observe({ if(is.na(input$value)){return()} if(input$value < 0){ react$value =0 updateNumericInput(session, "value", value = react$value) } else { react$value <- input$value } }, priority = 1 ) output$result <- renderText({ if(is.na(input$value)){return()} sqrt(react$value) }) })function LT(number1,number2) {return (number1 < number2);}function LE(number1,number2) {return (number1 <= number2);}function GT(number1,number2) {return (number1 > number2);}function GE(number1,number2) {return (number1 >= number2);}
function toSymbol(expr) { if(expr=="LT"){return("<")} if(expr=="LE"){return("≤")} if(expr=="GT"){return(">")} if(expr=="GE"){return("≥")}}
function validate(inputID, expr, limit){ var element = document.getElementById(inputID); element.onchange=function(){ if(expr(element.value,limit)){return} else { label = element.previousElementSibling.innerText; swal({ title: label + " has to be " + toSymbol(expr.name) + " " + limit, confirmButtonText: "OK" }); element.value = null} };}validate('myInputID',GE,0);
validate(firstInputID,expr,limit);
validate(secondInputID,expr,limit);
...--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/1bf21459-0236-4e31-a0af-5983383213fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
req(!any(is.na(reactiveValuesToList(input))))
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/632f8dcd-089a-4e5e-9467-19b699a9511e%40googlegroups.com.
observe({
data() %>%
ggvis()%>%
bind_shiny())}