for information
in the documentation for onAfterValidate :
a form id
the validation result (true or false)
myform.attachEvent(“onAfterValidate”, function (id, result){
//any custom logic here
});
but in fact, the first parameter is true or false, not the second one.