@byblyk posted a new topic, subject "Model is being updated but not submitting the updated data". It read:

   I've got a weird issue i'm trying to trace down. I'm validating form data then if it's valid i call a promise to geocode and address in the form to get the lat and lng. I save that lat and lng to this.model.lat and this.model.lng. I then run a save method, in the save method i have a console.log to check the value of model.lat and it's valid but when the model gets submitted it's null… wtf?
    
    When save runs the last two values lat and lng are null but in the console log at the top of save they are populated… what is going on here?
    [code] 
        validate () {
            this.$validator.validateAll().then(isValid => {
              this.$emit('on-submit', isValid)
              if (isValid) {
                var clientAddress = this.model.street + ' ' + this.model.city + ' ' + this.model.province + ' ' + 'Canada'
                var geocoder = new google.maps.Geocoder()
                var getLatLng = this.geocodeAddress(clientAddress, geocoder).then(function (result) {
                  this.model.lat = result[0]
                  this.model.lng = result[1]
                  this.save()
                }.bind(this))
              }
            })
          },
          geocodeAddress (address, geocoder) {
            return new Promise(function (resolve, reject) {
              geocoder.geocode({
                'address': address
              }, function (results, status) {
                if (status === 'OK') {
                  resolve([results[0].geometry.location.lat(), results[0].geometry.location.lng()])
                } else {
                  reject(new Error('Couldnt\'t find the location ' + address))
                }
              })
            })
          },
          async save () {
            console.log(this.model.lat)
            try {
              const response = await RequestService.add({
                identifier: this.model.identifier,
                policyno: this.model.policy,
                insureco: this.model.insureco,
                brokerco: this.model.brokerco,
                brokername: this.model.brokername,
                hofirstname: this.model.firstname,
                holastname: this.model.lastname,
                street: this.model.street,
                city: this.model.city,
                region: this.model.region,
                postal: this.model.postal,
                hphone: this.model.hphone,
                wphone: this.model.wphone,
                email: this.model.email,
                filename: this.model.filename,
                apptdate: this.model.appointmentDate.toISOString().slice(0, 10),
                coverage: 1,
                specialinstr: null,
                assignto: null,
                formid: this.model.form,
                lat: this.model.lat,
                lng: this.model.lng
              })
              this.$router.push({
                path: '/requests'
              })
            } catch (error) {
              this.error = error.response.data.error
            }
          }
    [/code]

To which @byblyk replied

    After some more trial and error, i found out i'm unable to alter my resoponse, if i put the lat or lng in an already defined field it takes it but if i create a new field like lat and lng it ignores them.
    [code] 
        async save () {
            console.log(this.model.lat)
            try {
              const response = await RequestService.add({
                identifier: this.model.identifier,
                policyno: this.model.policy,
                insureco: this.model.insureco,
                brokerco: this.model.brokerco,
                brokername: this.model.brokername,
                hofirstname: this.model.firstname,
                holastname: this.model.lastname,
                street: this.model.street,
                city: this.model.city,
                region: this.model.region,
                postal: this.model.postal,
                hphone: this.model.hphone,
                wphone: this.model.wphone,
                email: this.model.email,
                filename: this.model.filename,
                apptdate: this.model.appointmentDate.toISOString().slice(0, 10),
                coverage: 1,
                specialinstr: null,
                assignto: null,
                formid: this.model.form
              })
              this.$router.push({
                path: '/requests'
              })
            } catch (error) {
              this.error = error.response.data.error
            }
          }
    [/code]

So @andris.vilde (Andris Vilde) replied

    You have shared 3 methods but not the VueJS instance properties and setup.
    
    Can you reproduce your issue in JSFiddle or Codepen?
    
    Also how does `RequestService.add` static method look like? From which framework is it?

After which, @byblyk added

    Well i'm an idiot. There was a typo in my API. It's fixed and everything links up nice now.


{'source': 'discourse', 'url': 'https://forum.vuejs.org/t/model-is-being-updated-but-not-submitting-the-updated-data/40163', 'title': 'Model is being updated but not submitting the updated data', 'views': 208, 'has_accepted_answer': True, 'word_count': 537, 'like_count': 0, 'reply_count': 2, 'participant_count': 2, 'posts': 4, 'tags': '', 'author': '@byblyk', 'participants': '@byblyk, @andris.vilde (Andris Vilde)', 'image_url': [None], 'created_at': '2018-08-05T07:02:34.943Z', 'last_posted_at': '2018-08-05T07:37:53.906Z'}