Issue with R Shiny modal dialog and observe event on action button


I have a button "launch" clicking on which opens a modal popup. In this popup I have a datatable populated, allowing users to filter records and there is a submit button. on clicking the submit button,observeEvent(input$submit) it takes the records and populates the parent page of the modal. I close the modal by calling removeModal().
This works fine the first time.
However if I click the "launch" button second time, it automatically calls the observeEvent of the submit button observeEvent(input$submit) and takes the records and populates the parent page.
Is there a way to prevent this from happening. I just want the modal to show up again for user to filter the records.

I tried putting the logic inside submit button in isolate() , but it did not resolve.


observeEvent(input$submit, ignoreInit = TRUE, {

Hi Paul,

Thanks, yes it worked fine.
I have been trying so many workarounds including javascript click handling and reactive values, but couldn't get through.
This single line fixed it though !!

1 Like