generic validation for form fields