Skip to content

Commit

Permalink
Merge pull request #103 from lonix1/lonix1-patch-1
Browse files Browse the repository at this point in the history
docs: debounce
  • Loading branch information
haacked authored Mar 19, 2024
2 parents 5008fe3 + da797d3 commit b1fb7f7
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 b1fb7f7

Please sign in to comment.