Input dialog ValueChangeEvent

Is it possible to use a ValueChangeEvent on a field in a Input Dialog?
The user will use a scanner to scan a location, if the location is correct, the result must be the same as if there is a ‘OK’ button.
We don’t want to have a ‘OK’ button!

Jmix version: 1.5.5
Jmix Studio plugin version: 2.1.0-232
IntelliJ version: IntelliJ IDEA 2023.2.4

Hello!

You can add ValueChangeEvent listener only providing custom field via withField() method:

dialogs.createInputDialog(this)
        .withParameter(InputParameter.stringParameter("field1")
                .withField(() -> {
                    TextField<String> textField = uiComponents.create(TextField.NAME);
                    textField.addValueChangeListener(vce -> {
                        // do something
                    });
                    return textField;
                }))
        .show();

However, you cannot close dialog from this listener. Also, InputDialog always generates action buttons: from predefined io.jmix.ui.app.inputdialog.DialogActions enum or from custom actions.

If you have complicated logic in dialog it is better to use custom screen and show it as dialog.