<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSControlTextEditingDelegate/control(_:didFailToValidatePartialString:errorDescription:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSControlTextEditingDelegate(im)control:didFailToValidatePartialString:errorDescription:"
  },
  "title" : "control(_:didFailToValidatePartialString:errorDescription:)"
}
-->

# control(_:didFailToValidatePartialString:errorDescription:)

Invoked when the formatter for the cell belonging to `control` (or selected cell) rejects a partial string a user is typing into the cell.

```
@MainActor optional func control(_ control: NSControl, didFailToValidatePartialString string: String, errorDescription error: String?)
```

## Parameters

`control`

The control whose cell rejected the string.

`string`

The string that includes the character that caused the rejection.

`error`

A localized, user-presentable string that explains why the string was rejected.

## Discussion

You can implement this method to display a warning message or perform a similar action when the user enters improperly formatted text.

## See Also

  <doc://com.apple.documentation/documentation/Foundation/Formatter/isPartialStringValid(_:newEditingString:errorDescription:)>



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)