I'd say an onError event handler:
http://www.devguru.com/Technologies/ecmascript/QuickRef/evhan_onerror.html
http://www.w3schools.com/js/js_onerror.asp
But you might want to dig deeper to get the value of the error and include some helpful text (or reset whatever field happens to be the cause of the error, if any.) My .02.


