# IgnoreValidation()

> Disables _onValidateValue until the returned scope is disposed.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.7/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

```csharp
public BaseField<TValueType>.IgnoreValidationScope IgnoreValidation()
```

### Returns

| Type                                                                                                                | Description                                       |
| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| [IgnoreValidationScope](/engine/6000.7/script-reference/unityengine/uielements/basefield1/ignorevalidationscope.md) | A scope that re-enables validation when disposed. |

### Remarks

Scope this method with a `using` statement and use it with the [\_value](/engine/6000.7/script-reference/unityengine/uielements/basefield1/value.md) setter or [BaseField\<TValueType>.SetValueWithoutNotify](/engine/6000.7/script-reference/unityengine/uielements/basefield1/setvaluewithoutnotify.md) to assign a value that bypasses validation. Only [\_value](/engine/6000.7/script-reference/unityengine/uielements/basefield1/value.md) results in a [ChangeEvent\<T>](/engine/6000.7/script-reference/unityengine/uielements/changeevent1.md). The scope can be nested safely.

The following example sets a value that skips the field's validation:

### Examples

```csharp
using UnityEngine;
using UnityEngine.UIElements;

namespace MyNamespace
{
    public class BaseFieldIgnoreValidationExample
    {
        // The field clamps its value to a maximum. IgnoreValidation sets a value that skips the clamp.
        public IntegerField CreateField()
        {
            var field = new IntegerField("Value");
            const int max = 100;

            field.onValidateValue += v => Mathf.Min(v, max);

            // Set a value above the maximum without clamping it.
            using (field.IgnoreValidation())
                field.value = 500;

            return field;
        }
    }
}
```
