Skip to content

Commit 0b0a740

Browse files
committed
doc(validation): document the defaultValidationTrigger config option
See aurelia-validation release 1.6.0
1 parent 0d7c3b9 commit 0b0a740

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

current/en-us/7. plugins/3. validation.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,29 @@ export class RegistrationForm {
285285
}
286286
```
287287

288+
#### Changing the default Validate Trigger
289+
290+
You can configure the default validation trigger that every controller uses without having to change each controller yourself. You can access the validation configuration when you register the validation plugin during bootstrapping.
291+
292+
```JavaScript Configuring the default validate trigger
293+
import {validateTrigger} from "aurelia-validation";
294+
295+
export function configure(aurelia) {
296+
aurelia.use.plugin("aurelia-validation", config => {
297+
config.defaultValidationTrigger(validateTrigger.manual);
298+
});
299+
}
300+
```
301+
```TypeScript Configuring the default validate trigger
302+
import {GlobalValidationConfiguration, validateTrigger} from "aurelia-validation";
303+
304+
export function configure(aurelia) {
305+
aurelia.use.plugin("aurelia-validation", (config: GlobalValidationConfiguration) => {
306+
config.defaultValidationTrigger(validateTrigger.manual);
307+
});
308+
}
309+
```
310+
288311
### validate & reset
289312

290313
You can force the validation controller to run validation by invoking the `validate()` method. Validate will run the validation, render the results and return a `Promise` that resolves with a `ControllerValidateResult` instance. *The promise will only reject when there is an unexpected application error. Be sure to catch these rejections like you would any other unexpected application error.*

0 commit comments

Comments
 (0)