ui.Dialog.accept()

The Accept() method is used to accept the value inputted to the current field and terminate the current dialog. The method is equal to Accept key press. The method can prove useful when you want to terminate input from a function, where it is impossible to manipulate the calling routine dialog.