Enter the Dragon / DoSave

  • 0
  • 1
  • Question
  • Updated 2 years ago

I think that in time I will need to move to Scooby Doo or similar but for now, I'm using a simple DoSave function along the lines of:

DoSave = (function(fn){
  return function(){
    //place your code to execute here before the following code which has the effect of calling the original DoSave() method
    var result=fn.apply(fn, arguments);
    return result;
  }
})(DoSave);

    and "Danimal" commented a few years back as follows:


BTW, if your code needs to abort QuickBase's saving of the record because perhaps your code determines something is amiss, you simply wrap an if statement around the fn.apply and QuickBase's original DoSave() will not execute. In light of someone again deleting my important comments I am renaming this technique the Enter The Dragon Technique. Deal with it.


Can anyone (Dan?) provide a simple example of exactly where / what the syntax is for aborting the save and returning to the edit screen i.e. a few lines of code using the above example.  I have tried the following:

If (errfield="")
  { 
   var result=fn.apply(fn, arguments)
   return result
  }

...which doesn't save the record (as expected) but a 2nd attempt at a save just freezes as I expect it is still looped into the previous call to the function

I have also tried:

 If (errfield="")
  { 
   var result=fn.apply(fn, arguments)
   return result
  }
 else
  {
   return()
  }

And that saves when I don't want it to...

Apologies for the simplicity of the question - it's the answer I'm struggling with, especially as I have 5 days left in trial mode before deciding to pay. After that I can take my time to learn other techniques.

Thanks,

Mark

Photo of Mark Springthorpe

Mark Springthorpe

  • 126 Points 100 badge 2x thumb

Posted 2 years ago

  • 0
  • 1

Be the first to post a reply!