1 Replies - 233 Views - Last Post: 26 April 2017 - 11:38 AM

#1 daymaker  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 11-February 17

Replace or update an exising object in an array

Posted 26 April 2017 - 10:48 AM

I'm trying to update an object which has a type="external" by clicking on the edit button. It brings up a pop-up, wherein I can enter the new information and it should then update the user accordingly.
But somehow it doesn't seem to work. It just triggers a page refresh and nothing happens at all. The object is not getting updated.
Could you please help me fix this?

JSFiddle

Is This A Good Question/Topic? 0
  • +

Replies To: Replace or update an exising object in an array

#2 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1790
  • View blog
  • Posts: 5,705
  • Joined: 15-January 14

Re: Replace or update an exising object in an array

Posted 26 April 2017 - 11:38 AM

There's a Javascript error in the console, it looks like it's in the updateData function and since there's a fatal error there then the form submit event never gets cancelled so it just submits normally. Your .edit-btn handler probably needs to be changed though, it looks like in that handler you add a new submit handler for the form. So if people click on those edit buttons 5 times (or click on 5 different edit buttons), then the update form is going to have 5 submit handlers. You only want to attach the submit handler once, or remove the handler after the form submits.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1