I have a Panel Dialog that contains an input field, OK button and
Cancel button. The validation of the input field must be done on the
server side.

When the user click on the OK button, I must either close (if the
input is valid) or not close (if the input is invalid) the dialog
pane. How can I achieve that ?

To close the panel dialog, I must use the prdefined behaviour (hide my
dialog pane), but if the validation fails, the predefined behaviour
must not be executed. The main problem is at the time the panel dialog
is rendered, I still don't know if I should close or not the dialog.
It will depend on the validity of the input field

Thanks in advance