> 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/reference/form-settings/validationoverview/clientside.md).

# Custom Validators

You can define your own Javascript custom validation calculation that will fire the same as the regular validators.

By selecting the `validator` type to `calc` and adding a calculation and error message you can have excellent control over validation.

!["Custom Validator"](https://701607561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LKI28WjQukQ2x6JNpYA-887967055%2Fuploads%2Fgit-blob-39983eba102c53dc0c47bf664426b93949e3e5a9%2FScreen%20Shot%202018-01-19%20at%206.47.50%20PM.png?alt=media)

```yaml
// example JSON for an element with custom validation
[
  {
    "label": "Some Password",
    "model": "password1",
    "placeholder": "",
    "styleClasses": "col-md-3",
    "type": "input",
    "fieldOptions": {
      "inputType": "text"
    },
    "required": true,
    "validator": "string"
  },
  {
    "label": "Another Password",
    "model": "password2",
    "placeholder": "",
    "styleClasses": "col-md-3",
    "type": "input",
    "fieldOptions": {
      "inputType": "text"
    },
    "required": true,
    "validator": "calc",
    "validator_calc": "model.password1 == model.password2",
    "errorMsg": "The passwords do not match"
  }
]
```
