I have a form inside a dialog which I close by clicking on commandbutton with ajax ,
like this
Two things 1) Checking for an error in the 'onevent' function
Surely you have a message tag for the mandatory field?
So you can check for the error-class something like
var message = $('#m-my-field-id');
if(message.hasClass('error-class'){
//do this
}
else{
//do that
}
2) The DOM isn't up to date on success
Yes, I can see the message on the page in Firefox, yet jQuery tells me it is not there.
I have found that using the smallest possible timeout is sufficient to fix this
setTimeout(
function(){
setErrorStyle(source.attr('id'));
},
1
);