implemented minLength
implemented maxLength