Success Criterion 3.3.1 Error Identification: [Level A]
The intent of this Success Criterion is to ensure that users are aware that an error has occurred and can determine what is wrong. The error message should be as specific as possible. In the case of an unsuccessful form submission, re-displaying the form and indicating the fields in error is insufficient for some users to perceive that an error has occurred. Screen reader users, for example, will not know there was an error until they encounter one of the indicators.
Techniques
Server side validation
If server-side validation identifies any errors it should re-display the page with error messages next to each missing field or display a list of them in some suitable message area on the page. It is also good practice to put an error notification in the title tag so that screen readers will not assume that every thing is hunky-dory and continue regardless. Clicking the 'submit' buttons demonstrates this.
Not so much a WCAG technique, but please note that server-side validation should always be provided regardless of whether or not client-side validation is performed.
Providing client-side validation and alert
Client-side validation should be provided where possible, it will possibly prevent a needless trip to the server if there are errors. Any validation errors can be shown as above for server-side validation but an alternative method is to display an alert dialog stating the offending field. In this example tab out pof the last name field without entering a value.