adding validation to fields