Back to list
Views:   2.5K
Replies:  0

Patterns in Action - JavaScript DataEntry app

I think I found a bug in the code. On the Update Customer function you are adding a customer instead of updating.

                    // this is wrong

Also, on the Submit function, what is the purpose of the line wherte var mod is set to the this.collection.get....

submit: function (event) {
                if (this.model.isNew()) {     // add
                        first: this.$('#first').val(),
                        last: this.$('#last').val()

                } else {       // update

                    var mod = this.collection.get(this.model.get("id")); <<<<===== what is this doing? mod is not used anywhere?
                    this.model.set("first", this.$('#first').val());
                    this.model.set("last", this.$('#last').val());
                    var url = this.model.url;
                    this.model.url = "customers";
                    this.model.url = url;
            cancel: function (event) {

Everardo Cunha, Apr 15, 2017
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.