# Events

Events emitted by the [VFG Component](/vue-generators/develop/component.md)

## validated

This event is triggered whenever the form has completed validating. It provides the `boolean` result of this validation, any errors that may have occurred and a reference to the VFG component which triggered the validation.

Internally, the event is triggered with

```javascript
this.$emit("validated", isValid, this.errors, this);
```

`isValid` will contain a `boolean` value indicating whether the form is valid, `true` indicates the the validation succeeded. `false` indicates that it failed, and the errors array will contain any error messages from the validation rules.

You can listen for this by attaching to the `@validated` (`v-validated`) event on the `<vue-form-generator />` component.

## model-updated

This event is triggered whenever the the model attached to the form has been updated, usually due to user interaction. It provides the new value and a reference to the property name for the field which was just updated. This event is triggered each time a field is updated.

Internally, the event is triggered with

```javascript
this.$emit("model-updated", newVal, schema);
```

`newVal` is the value that was just updated, and `schema` is a reference to the model's property name found in the [field schema](/vue-generators/develop/component/schema.md). `schema` will only contain the individual property name, and not the full schema. This allows you to identify which field was just updated.

You can listen for this by attaching to the `@model-updated` (`v-model-updated`) event on the `<vue-form-generator />` component.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vue-generators.gitbook.io/vue-generators/develop/component/events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
