Form validation before submission for required fields.