Skip to content

Commit

Permalink
docs: debounce
Browse files Browse the repository at this point in the history
  • Loading branch information
lonix1 authored Mar 19, 2024
1 parent 5008fe3 commit da797d3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,22 @@ v.addProvider('io', (value, element, params) => {

## Controlling when validation occurs

### Events

By default, validation occurs immediately upon changes to form fields: on `input` for inputs and textareas, and on `change` for selects.

One can change to a different event by setting a field's `data-val-event` attribute. For example, one can use `data-val-event="blur"` to validate that field on the `blur` event.

### Timing

To prevent unnecessary validation, a debounce of 300ms is used. This ensures validation does not occur for every keystroke, which is especially important during remote validation.

In some cases it may be unnecessary, for example when performing local validation on blur (rather than on change). To change the default:

```ts
v.debounce = 0;
```

## Subscribing to Client Form Validation Event

```ts
Expand Down

0 comments on commit da797d3

Please sign in to comment.