AP.dialog 'submit' and 'cancel' events

Hi,

I’m trying to use the AP.dialog with chrome: true, so I get the ‘Submit’ and ‘Cancel’ buttons by default. However, I can’t bind to them. The documentation says that both Dialog.on(event, callback) and DialogButton.bind(callback) are being deprecated in favor of AP.events.on("dialog.message", callback). However, when I use AP.events the only event I see firing is ‘dialog.close’ with no arguments (I monitor events via the AP.events.onAny). So I can’t distinguish whether the dialog was submitted or canceled.

How do I bind to the ‘Submit’ button of AP.dialog?

I think you’ll be interested in A problem with migration from DialogButton.bind() method.

Thank you, David. Yes, I’ve seen this too, and I can’t bind to default buttons (created with chrome: true) even with the AP.dialog.getButton('submit'). So I ended up exactly as you did: set the chrome option to false and created all the insides of the modal myself.

It properly fires dialog.submit when you listen “inside” of the dialog, not where you create it “outside”.