vendredi 23 juin 2017

Validate optional email with ember-cp-validations

I would like users to optionally insert an email using ember-cp-validations:

const Validations = buildValidations({
  managerEmail: {
    validators: [
      validator('presence', null), // means it can be optional
      validator('format', { type: 'email' })
    ]
  }
});

But it still requires an email and won't accept an empty field. How can I make it optional?




Aucun commentaire:

Enregistrer un commentaire