Discussions

Expand all | Collapse all

DO and Save

  • 1.  DO and Save

    Posted 06-07-2017 08:05
    Hi

    What is the return value of DoSave() ?

    Thanks


  • 2.  RE: DO and Save

    Top
    Contributor
    Posted 06-07-2017 12:34
    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.