samedi 2 mai 2020

Ember Changeset Validations Not Validate Relationship Input Field

So i have a form that contain relationship input field. The form is using ember-changeset to proxy the office model. However the validations file seems doesn't support relationship input field. For field phone number it's not validated as i call the changeset.validate() when saving the form.

 /* office model */
 export default DS.Model.extend({
    phone: DS.belongsTo(),
 });

 /* phone model */
 export default DS.Model.extend({
   number: DS.attr('string'),
   country: DS.belongsTo('country')   
 });

 /* app/templates/component/form-office.hbs */
 <form >
   
   
 </form>

 /* app/validations/form-office.js */
 export default { 
   name: validatePresence({ presence: true }),
   'phone.number': validatePresence({ presence: true })
 }

i am using ember version 3.5.1 and installed ember-changeset-validations version 2.2.1

My question is there any example of how to handle this kind of scenario for form with multiple relationships input ?




Aucun commentaire:

Enregistrer un commentaire