How to get modal confirm event on Miro SDK 2.0

  • 19 September 2022
  • 3 replies

Badge +2

Hi everyone

I need to run some scripts when I click confirm button on the modal(setSnapshotNameModal.html)

So I used this scripts. If I click close button, it works but when l click confirm button, it doesn’t work.

Please let me know your thought.

Thank you

3 replies

Userlevel 2
Badge +1

Hi @Maxim Huryanov,

Thank you for reaching out, and for building with the Miro Web SDK!

The screenshot you shared shows how to open the modal. This code is usually in the headless iframe or in the panel iframe, if your app.

The modal should include the code to handle events associated with the OK and Cancel buttons on the modal that you're building. Is the logic to handle clicking OK and Cancel buttons in the modal code?  

For reference, you can see this article; they give a conceptual overview of how Miro apps are structured, and which iframe is relevant to running specific sections of the app code: 

This is the part of the article that is specific to the modal:

Badge +2

Hi @Marco Spinello 

Thanks for your reply.

Well I defined the handle events of OK and Cancel button on setSnapshotName.html.

I need to run some functionalities on main js when I click the OK button.

Above example, the console have to display “Modal Confirmed” when I press OK button.

But it doesn’t work. But If I press ✖ button, the console display “Modal confirmed”.

Please let me know how to solve this issue.

Thank you

Userlevel 2
Badge +1

Hi @Maxim Huryanov

Apologies for my late reply to your previous message.

Would it be OK for you to share the code of the app you're building?
We could have a look at it here and try to reproduce the same issue you are encountering.

Just for me to make sure I understand correctly:

In the setSnapshotName.html file, are you referencing the module/the JS code that handles the click events for the OK and Cancel buttons?

If we could have a look at your code, it would give us extra context.

Thank you + wish you a great day!