# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.klai.studio/v1/reference/actions-processor/actions_overview/validate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
