Allow overriding onSubmit event in dialogs.

Fixes #2327 

@dinhviethoa PTAL thanks.