Implemented form validation.