File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
apps/docs/guide/form-generator Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 1
1
These are events emitted by the ` vue-form-generator ` component.
2
2
3
+ ## ` field-validated `
4
+ Emitted when a field inside the form has been validated.
5
+
6
+ ### Event arguments
7
+ - ` validations ` - an object with the field's errors and the field schema
8
+ - ` fieldErrors ` - an array of error messages that have been thrown during validations;
9
+ - ` field ` - the field as defined in the schema
10
+
11
+ An example from the [ ` FieldObject ` ] ( /guide/fields/FieldObject ) component:
12
+ ``` vue [FieldObject.vue]
13
+ <script setup>
14
+ const onFieldValidated = (validation) => {
15
+ const key = `${field.value.model}.${validation.field.model}`
16
+ emits(
17
+ 'validated',
18
+ validation.fieldErrors.length === 0,
19
+ validation.fieldErrors,
20
+ { ...field.value, model: key }
21
+ )
22
+ }
23
+ </script>
24
+ ```
25
+
3
26
## ` submit `
4
- Emitted when all fields have been validated and no errors occurred during said validations.
27
+ Emitted when all fields have been validated and no errors occurred during said validations.
You can’t perform that action at this time.
0 commit comments