Try out setCustomValidity()

Type puppy into the input. Check the page's source to see how this form works.

Note: this demo works best with Chrome or Firefox. Check Webshim for a polyfill.