Implemented form validation functionality.