Anna Bokovskaya Anna Bokovskaya - 4 months ago 12
HTML Question

Input button does not work in my shiny app

I created a shiny app. But the input button is not reactive.
Here is a snapshot of the code:

server:

A<-reactive({
x<-input$RunModel
quit()##Their is another function here, i wrote quit() just for ilustration
})


HTML:

<INPUT style="background-color:#143d4d;color:white;" onclick="newDoc(this.value)" TYPE="button" id="RunModel" class="btn btn-primary" VALUE="Run Model"/>


But unfortunately this button is not reactive. I searched on the web and I found that it should work. What happened?

Answer

I figure it out how to do it.
with observeEvent method. here is a snapshot of the code:

  observeEvent(input$RunModel,label ="Write a label for debugging",function() {
   quit()
  })

Now when i click the 'RunModel' button it will active the observeEvent. And quit the app.

Comments