skuid model save returns 'done' promise despite missing required field warning

  • 2
  • Problem
  • Updated 2 years ago
  • (Edited)
Hello Skuid!

I am calling skuid.model.save() in a snippet like so:

'saveAllSnippet': function () {
var modelsToSave = [],
modelsToExclude = ['AddTests','ProcessLog','ChangeTracker','ShowTabs','UI_Model','DefaultTo','ChartAudit'],
dfd = new $.Deferred(); $.each(skuid.model.map(), function(){
if (this.hasChanged && (modelsToExclude.indexOf(this.id) === -1) && this.preventUnloadIfUnsavedChanges) { modelsToSave.push(this); }
}); $.when(skuid.model.save(modelsToSave))
.done(function(){
console.log('All Models Saved.'); dfd.resolve(); })
.fail(function(){
console.log('All Model Save Failed.'); dfd.reject(); });
return dfd.promise();
}

As you can see from the image below, the .done() response is being called from $.when() despite the fact that the model is throwing a missing required field error.


Help?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 2 years ago

  • 2

Be the first to post a reply!