add form validation functionality.