# [Usage](../../../usage.md) > [Components and standard attributes](../basics.md) > Validate

---

`updateOnChange` | `->setUpdateOnChange`

Valid only for form components inside a form or a modal with a form. This function will trigger a request to the backend to validate the inputs at the form submit. Is useful to define the input validation without validate them manually in the store/update function.

```php
Input::make('password')
    ->setType('password')
    ->setLabel($record ? 'Update password' : 'Set password')
    ->setRequired($record ? false : true)
    ->setValidate([
        'min:8',
        'confirmed',
        'regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]+$/'
    ])
    ->setHint('<b>NOTE</b>: password must contain at least 8 characters, an uppercase letter, a lowercase letter and a special char.')
```

Validate is an array of standard validation rules, but can also handle objects:

```php
use Illuminate\Validation\Rules\Password;

Input::make('password')
    ->setType('password')
    ->setLabel($record ? 'Update password' : 'Set password')
    ->setRequired($record ? false : true)
    ->setValidate([
        'min:8',
        'confirmed',
        Password::min(8)->mixedCase()->numbers()->symbols()
    ])
    ->setHint('<b>NOTE</b>: password must contain at least 8 characters, an uppercase letter, a lowercase letter and a special char.')
```

_NOTE_: For security reasons, the validation request is always delayed by 50ms.

| Types              | Default |
|--------------------|---------|
| `Closure`, `array` | `null`  |

Backend validation rules for Form fields inside a `Form` / `Modal` with form, checked at submit (with a 50ms-debounced request). Accepts Laravel rule strings, Rule objects, or Closures. When omitted (`null`) only `required` presence (if set) applies.
Use for format, uniqueness, and confirmation logic without manual store / update checks.

### Example
Blade:
```php
{!! \KFramework\Components\Forms\Input::make()->setName('email')->setValidate(['required', 'email']) !!}
```
Controller:
```php
Input::make('email')->setRequired(true)->setValidate(['required', 'email']);
```

### Interaction / tips
- Pair with `required` (../shared_attributes/required.md): presence + format; explain with `hint` (../shared_attributes/hint.md).
- Runs before `action` (../shared_attributes/action.md) on `Form` submit; failing validation blocks the action.
- `updateOnChange` (../shared_attributes/update_on_change.md) can re-validate reactively.

See also: [required](required.md), [hint](hint.md), [action](action.md), [updateOnChange](update_on_change.md), [basics](../basics.md), [Form](../forms/form.md).