Imagine you're making an app where someone needs to sign up. Easy enough to imagine, you've probably built a bunch of them. When they sign up, they supply their email, password, and a screen name. By the laws of the system, the screen name and email must be unique and the password must contain letters and numbers. I generally stop about #3, but then I'm also very lazy.
Attempt 1: Simple form, put in your screen name, email, and password (and password confirmation) and submit. If the screen name or email are in use or the password isn't valid, you get an error back saying there's a problem with that field and are asked to go back, fix it, and resubmit.
Attempt 2: Same form, but when you submit, if there is a problem, the form is displayed again with your inputs and errors.
Attempt 3: Invoke JavaScript to do some on-the-spot validation. Disable the submit button until the password is valid and matches the confirmation, the email is a valid email, and the screen name is filled out.
Attempt 4: AJAX time, include a button to check the availability of your screen name and email before hitting submit.
Attempt 5: If the email is in use, give the user a "forgot my password" form. If the screen name is in use, show a list of available screen names that are similar to choose from.
Attempt 6: After hitting the "check screen name availability" button, the screen name is put in a reserve status so someone else can't ninja it while the user fills out the rest of the form.
Attempt 7: Take out the "check availability" buttons and do it onChange or onBlur on the fields.