DO and Save

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • In Progress
Hi

What is the return value of DoSave() ?

Thanks
Photo of Shihad

Shihad

  • 496 Points 250 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,532 Points 20k badge 2x thumb
It returns a Boolean value if a check for "errors" did not find any:

function DoSave(subact, context) {
  if (!subact) {
    var subact = "save"
  }
  var ruleResults = new Object();
  RecalcDependents(kFormSaved, 0, null, ruleResults);
  if (MissingRequiredFields()) {
    return
  }
  if (ruleResults.abortSave) {
    DisplayAbortMsg(ruleResults);
    return
  }
  var maxGeID = 0;
  for (var GeID in gGeData) {
    if (!GE_validate(gGeData[GeID])) {
      return
    }
    maxGeID = Max(maxGeID, GeID)
  }
  var ruleResults = new Object();
  RecalcDependents(kFormSavedPostCheck, 0, null, ruleResults);
  var prePostValues = (ruleResults.oldVals ? CopyObject(ruleResults.oldVals) : null);
  if (ruleResults.abortSave) {
    RestorePrevalValues(prePostValues);
    DisplayAbortMsg(ruleResults);
    return
  }
  var success = CheckForErrorsAndSaveIfNone(subact, context, maxGeID);
  if (!success) {
    RestorePrevalValues(prePostValues)
  }
  return success
}
That said I would stay away from using it. When customizing a QuickBase authored page with your own script it is a better practice to emulate user input rather than muck around with their code.