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
  • You can add the onchange event like this , so that this will trigger only on actual field change 

     this.model.once( "sync",
                function() {
                    this.model.on(
                        "change:{field_name}",
                        this.{function_name},
                        this
                    );                
                },
                this
            );
Reply
  • You can add the onchange event like this , so that this will trigger only on actual field change 

     this.model.once( "sync",
                function() {
                    this.model.on(
                        "change:{field_name}",
                        this.{function_name},
                        this
                    );                
                },
                this
            );
Children
No Data