# changeEvents

### Description

This value is used for do operations like disable field, enable field, set validator to the another field, remove validators of another field, set value to the another field on change of the field.

### Hint

Type:  **Array\<NgMatFormFields>**

Example:&#x20;

```typescript
Fields: NgMatFormFields[] = [{
        type: 'input',
        label: 'User Name',
        placeholder: 'Enter a User Name',
        formControlName: 'name',
        directive: 'numericOnly',
        maxLength: '10',
        validators: [Validators.required, Validators.email]
    },{
    type: 'checkBox',
    label: 'Confirm Password',
    placeholder: 'Enter a Password',
    formControlName: 'checkbox',
    list: [
        {
            name: 'Infinity War',
            value: 'Avengers'
        }
    ],
    changeEvents: [{
        // If the value is true the following operations happen
        value: true, 
        // Array of formControl names which need to be disabled
        disable: ['name'], 
        // Array of formControl names which need to be enabled
        enable: ['name'], 
        //Array of FieldValueModel to set value for another controls of form group
        setValue: [{ formControlName: 'name', value: 'Satheesh' }], 
        // Array of formControl names which validators to removed
        removeValidators: ['name'], 
        //Array of FieldValueModel to set validators for another controls of form group
        setValidators: [{ formControlName: 'name', validators: [Validators.required] }]
    }]
}];
```


---

# 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://msk-satheesh-5599.gitbook.io/ng-mat-forms/attributes/fields/changeevents.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.
