I have the following:
I simply use oninvalid to set the custom validty error message and then use onchange to reset the message so the form can submit.
oninvalid
onchange