> For the complete documentation index, see [llms.txt](https://docs.klai.studio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.klai.studio/v1/reference/actions-processor/actions_overview/validate.md).

# validate

Runs the page validation routine.

| Key            | Type       | Description                                             |
| -------------- | ---------- | ------------------------------------------------------- |
| action         | 'validate' | Action name                                             |
| action.options | object     | No supported options at this time                       |
| onFailed       | function   | add `_actions` to run actions when the validation fails |

**Example**

```yaml
// This Button will validate and the run a hook
// if the validation fails on the page, the UtilityHook will NOT run
{
  "actions": [
    {
      "action": "validate"
    },
    {
      "action": "runUtilityHook",
      "options": {
        "someKey": "myButtonParameter"
      }
    }
  ],
  "buttonClasses": "btn btn-info",
  "label": "",
  "styleClasses": "col-md-2",
  "text": "Save This Form",
  "type": "button"
}
```

## Running action Scripts when validation fails

Often you want to run actions when a validation fails. The `onFailed` key is perfect for this. Action sin the original script will stop and the `onFailed_actions` script will run. You can use this to do things like pre-save forms, show modals and more.

##

## See Also

Learn more about how to validate fields at this page:

{% content-ref url="/pages/-LKI579qxSqvkAmlhrO2" %}
[Validation](/v1/reference/form-settings/validationoverview.md)
{% endcontent-ref %}
