Customizing ConfirmDialog

This is a ConfirmDialog. I want to use reject button as dialog.setRejectButton("Clear",event -> inputForm.clear());
the problem is, when clicking this button, the dialog is getting closed instead of the event I specified here. How to fix this?

It’s probably 10 times easier to just build your own dialog. The confirm dialog is not really meant for forms and other stuff.

To me it looks like there is no API to prevent that default action. I also guess the components team would reject such a feature as it is not a real use case for confirm dialog, so doing what @quirky-zebra suggested is the way to go, as usual.

But maybe there should be FormDialog or similar with slightly different API and feature set :thinking:

I tend to use this kind of popup forms as well in admin views.

I’ve done the same, took me like 20 lines for a re-usable dialog thanks to the newish header and footer API :partying_face:

FormDialog has been considered, but yeah, it’s very very easy to just build your own. Absolutely no reason to use ConfirmDialog for that.


But the ConfirmDialog is not preventing users to think the way I used and then wondering why it is not working.

How would you have liked to be prevented in this case?

Allow renaming the button text and enable only the confirm Button action

I think by this way, developer knows there are some restirctions

setConfirmButton(“name”, e->…);