I\'ve got the following HTML5 form: http://jsfiddle.net/nfgfP/
By setting and unsetting the setCustomValidity in the right time, the validation message will work flawlessly.
setCustomValidity
I used onchange instead of oninput which is more general and occurs when the value is changed in any condition even through JavaScript.
onchange
oninput