Handle form validation.