---
title: "control(_:didFailToValidatePartialString:errorDescription:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscontroltexteditingdelegate/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.

## Declaration

```swift
@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

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

### Related Documentation

- [isPartialStringValid(_:newEditingString:errorDescription:)](foundation/formatter/ispartialstringvalid(_:neweditingstring:errordescription:).md)

### Validating a Control’s Value

- [control(_:isValidObject:)](appkit/nscontroltexteditingdelegate/control(_:isvalidobject:).md)
