Add functions for form validation