Why does 'on change' fire when record view is loaded?

I must be missing something...

Why do on change events fire when the record view is loaded before that field is indeed changed?

How can I stop the execution of an on change until the field is actually changed?

thanks,
Francesca
Parents
  • I think when the view renders model attribute are getting set, which is a change.
    Inside the function you can give a condition like this to prevent the execution of the function body.
    if(!_.isEqual(this.model.get('<attribut>'),this.model.previous('<attribute>'))){
           //execute the function body
    }
Reply
  • I think when the view renders model attribute are getting set, which is a change.
    Inside the function you can give a condition like this to prevent the execution of the function body.
    if(!_.isEqual(this.model.get('<attribut>'),this.model.previous('<attribute>'))){
           //execute the function body
    }
Children
No Data