mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-30863] updated validators to set proper button state (#10667)
This commit is contained in:
@@ -252,13 +252,29 @@ There are two other functions that can be very useful when you need to control f
|
||||
|
||||
### Field Validators
|
||||
|
||||
You can supply a set of validator objects to the form using the `fieldValidators`
|
||||
property. Each validator implements a check for a particular type of data (eg, a
|
||||
date validator might check that the date in the field falls between 1980 and 2017).
|
||||
You can supply a set of validator objects to the form using the `fieldValidators` property. To do this you must use Token `FORM_CLOUD_FIELD_VALIDATORS_TOKEN`. This is a A DI token that allows to inject additional form field validators. Each validator implements a check for a particular type of data (eg, a date validator might check that the date in the field falls between 1980 and 2017).
|
||||
ADF supplies a standard set of validators that handle most common cases but you can
|
||||
also implement your own custom validators to replace or extend the set. See the
|
||||
[Form Field Validator](../../core/interfaces/form-field-validator.interface.md) interface for full details and examples.
|
||||
|
||||
```ts
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FORM_SERVICE_FIELD_VALIDATORS_TOKEN } from '@alfresco/adf-core';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
...Import Required Modules
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: FORM_SERVICE_FIELD_VALIDATORS_TOKEN,
|
||||
useValue: [new AdditionalFormFieldValidator()]
|
||||
}
|
||||
]
|
||||
})
|
||||
export class ExampleModule {}
|
||||
```
|
||||
|
||||
### Common scenarios
|
||||
|
||||
#### Rendering a form using form definition JSON
|
||||
|
@@ -15,7 +15,6 @@ Based on property taskDetails: TaskDetailsCloudModel shows a form or a screen.
|
||||
<adf-cloud-user-task
|
||||
[appName]="appName"
|
||||
[displayModeConfigurations]="displayConfigurations"
|
||||
[fieldValidators]="formFieldValidators"
|
||||
[showTitle]="false"
|
||||
[showValidationIcon]="false"
|
||||
[taskId]="taskId"
|
||||
@@ -38,7 +37,6 @@ Based on property taskDetails: TaskDetailsCloudModel shows a form or a screen.
|
||||
|---------------------------|---------------------------------------|---------------|---------------------------------------------------|
|
||||
| appName | `string` | "" | App id to fetch corresponding form and values. |
|
||||
| readOnly | `boolean` | false | Toggle readonly state of the task. |
|
||||
| fieldValidators | `FormFieldValidator[]` | | Allows to provide additional validators to the form field. |
|
||||
| showCancelButton | `boolean` | true | Toggle rendering of the `Cancel` button. |
|
||||
| showCompleteButton | `boolean` | true | Toggle rendering of the `Complete` button. |
|
||||
| showTitle | `boolean` | true | Toggle rendering of the form title. |
|
||||
|
Reference in New Issue
Block a user