I need to change 'presence' option from 'true' to 'false' depending on dynamic form state. If formState == 'a' 'name' field is required, if == 'b' then not, and if I dynamically toggled formState, validator should change its option.
I tried do that, but it didn't help:
//form/component.js
init() {
this._super(...arguments);
const Validations = buildValidations({
name: validator('presence', {
presence: Ember.computed('formState', function() {
return this.get('formState') == 'a';
})
}),
});
// I use ember-validated-form-buffer for buffering changes
this.set('formValues', formBufferProperty('model', Validations));
}
Is there any way to solve it?
Aucun commentaire:
Enregistrer un commentaire