validation for required fields working