partyelite
partyelite

Reputation: 892

Aurelia validation in activate method

I have a validation rules set up and they work.

this.validation.on(user).ensure('name').isNotEmpty()...

But how can I trigger validation in activate method? I have tried

this.validation.validate();

but the fields in the form don't change (validation errors are not displayed). Only when I start typing the validation messages are displayed on the form.

Upvotes: 0

Views: 375

Answers (1)

Michael Malone
Michael Malone

Reputation: 616

activate happens in the lifecycle before the form (viewmodel) is attached to the DOM. Try calling the method like you were in the attached callback and see how you go.

the lifcycle order I am aware of is:

  • created
  • canActivate
  • activate
  • bind
  • attached
  • canDeactivate
  • deactivate
  • detached
  • unbind

Upvotes: 1

Related Questions