You can bind to the form's submit event using jQuery. When the form gets submitted you can check if it is valid, if it isn't then you can popup the dialog.
var form = $('#yourform');
form.submit(function() {
if(!form.valid()) {
alert('The form is not valid!!');
}
});