Skip to content
Back to skills

Handsontable Validator Dev

ASecurity

Use when creating or modifying a Handsontable cell validator - async callback-based validation functions that determine if cell values are valid

  • 22,083 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 19, 2026
developmentgo

Works with

  • cli

Security analysis

A100/100

Scanned November 9, 2026

npx -y skills add handsontable/handsontable --skill handsontable-validator-dev --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Handsontable Validator Dev?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Handsontable Validator Dev
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/handsontable-handsontable-validator-dev/badge)](https://www.skillsdirectory.com/skills/handsontable-handsontable-validator-dev)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: handsontable-validator-dev
path: handsontable/src/validators/**
description: Use when creating or modifying a Handsontable cell validator - async callback-based validation functions that determine if cell values are valid
---

# Handsontable Validator Development

## Signature

```js
function myValidator(value, callback) {
  // `this` is bound to the cell's cellProperties object
  if (this.allowEmpty && (value === null || value === undefined || value === '')) {
    return callback(true);
  }
  callback(isValid(value)); // true = valid, false = invalid
}
```

## Rules

- Call the callback on every path; a missed call hangs the validation pipeline and silently blocks editing.
- `this` is `cellProperties`: use `this.allowEmpty`, `this.instance`, other cell meta. Use a `function` body, not an arrow function (arrows break the `this` binding).
- Validators only determine validity; data, DOM, and cell state stay untouched.
- The callback may run after async work; the editor stays in WAITING state until it resolves.

## Files

```
src/validators/{validatorName}/
  {validatorName}.ts    # Validator function
  index.ts              # Re-exports
```

Registry: `src/validators/registry.ts`.

```js
import { registerValidator } from '../../validators/registry';
registerValidator('myValidator', myValidator);
```

A new built-in validator also needs its entry in `src/validators/features.json` (`validator:<name_in_snake_case>`, `licensing: "none"`; copy a neighbor), and a cell type that uses it lists it in its `requires.allOf`. The unit suite fails until both exist. A validator folder that is never registered under a name (`maxLengthValidator`, `regExpValidator`) goes in the skip list of `scripts/utils/feature-manifest.js` instead, with the reason. Run `npm run generate:feature-manifest --prefix handsontable` and commit what it writes. Rules: `src/featureManifest/AGENTS.md`.

## Triggers

- The editor system during `finishEditing()`.
- `validateCells()`, `validateRows()`, `validateColumns()`.
- Invalid cells get the `htInvalid` class from the renderer pipeline, not the validator.

## Reference implementations

- `src/validators/numericValidator/numericValidator.ts` - `allowEmpty` support.
- `src/validators/dateValidator/dateValidator.ts`
- `src/validators/autocompleteValidator/autocompleteValidator.ts` - list of allowed values.

## Correcting cell values inside a validator

When a validator writes a corrected value with `setDataAtCell`, pass a source string ending in `'Validator'`:

```js
this.instance.setDataAtCell(row, col, correctedValue, 'myCustomValidator');
```

`validateChanges()` in `core.ts` uses the suffix to fold the correction into the change that triggered it, so that change still applies with the corrected value and fires `afterChange`. Without it, the correction is a separate write that wins over the triggering change (the last write to a cell wins), and the triggering change is dropped with no `afterChange`.

## Common mistakes

- Reading a meta flag that an editor forces in `prepare()`. `DropdownEditor.prepare()` writes `strict = true` onto the one cell it prepares, only while selected. A validator reading `this.strict` sees the column's own `strict: false` on every cell never clicked (paste, `setDataAtCell()`, `validateCells()`, any `updateSettings()` that rebuilds cell meta), which made a `strict: false` dropdown strict only in clicked cells (DEV-2911). For fixed cell-type behavior, pass it to the shared logic explicitly: `dropdownValidator` calls `validateAgainstSource(this, value, callback, true)`. Test by writing to a cell that was never selected; selecting it first hides the bug.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.