When requesting an important bit of information, such as an email address or a
password, you might want the user to enter the information twice so you can
verify that a typing error did not occur.
Instead of waiting for the user to submit the form, why not notify the user
when the passwords match (and more importantly, when they don't match)?
In the following form, make up a password and enter it in each field. When the
passwords match, a "thank you" message should appear. Try modifying one of the
passwords so they no longer match and see what happens.