Forum Discussion

_anomDiebolt_'s avatar
_anomDiebolt_
Qrew Elite
10 years ago

What is the Save and Scooby Doo Technique?

I heard there is a brilliant new Save and Do type technique called Save and Scooby Doo technique. Does anyone know how it works or where I can see a demo of it?

37 Replies

  • John>How about detecting if the user hits delete record? Can that be detected? and say get record id and user who did it?

    You should probably pursue QuickBase's Web Hook feature for this.
    I put together this handy dandy Venn Diagram to explain what can be done with JavaScript versus Native QuickBase:

    http://i.imgur.com/2psdwVK.jpg

    Using the image onload technique you can redefine  QuickBase's DoDelete() function to log the deletion to your own table using code similar to this:

    function DoDelete(nounSingular, dbid, rid) {
      var doHandleChecked = function() {
        kIsDelete = true;
        var dbidLog = "<your dbid>";
        var apptoken="<your apptoken>";
        $.ajaxSetup({data: {apptoken: apptoken}});
        $.post(dbidLog, {
          act: "API_AddRecord",
          _fid_6: rid,
          _fid_7: dbid
        }).then(function() {
          SetLocation(dbid + "?a=DoDeleteRecord&rid=" + rid + "&rl=" + GetValue("rl") + "&PageToken=" + GetValue("PageToken"));
          $(this).dialog("close")
        });
      };
      var msg = "<p>Are you sure you want to delete this " + nounSingular + "?<p>";
      QB.Dialog.confirm({
        title: "Delete " + nounSingular + "?",
        type: "Warning",
        size: "medium",
        contents: msg,
        contentType: "html",
        id: "dialogConfirmDeleteRecord",
        confirm: {
          text: "Delete",
          type: "Danger",
          click: doHandleChecked
        }
      })
    }
  • Dan, did you ever answer Dean's question about ie and firefox? I couldn't find it. I always use chrome and my script works fine, but when I use firefox, ie, or edge, it executes all of the code in the $("<iframe>")... block on page load.
  • I don't have time to sort through all the twists and turns of this thread. Post a new self contained question with relevant details and I will try to answer. It should work in all browsers.
  • I just made an update to the Save and Scooby Doo code to deal with a situation that may have effected behavior on Internet Explorer and FireFox. Apparently Chrome operates differently than Internet Explorer and FireFox when an <iframe> is placed in the DOM without any content.

    Chrome
    does not fire a load event until content is added while Internet Explorer and FireFox appear to fire a load event even if the <iframe> has no content. I suspect the intermittent operation on Internet Explorer and FireFox is due to a timing issue where the initial load event may sometimes occur before the event listener is created.

    To patch up path up the code and make it work in all browsers consistently I have added an if statement to the code which tests if the href of the iframe is set to "about:blank":

    .on("load", function() {
     if (this.contentDocument.location.href != "about:blank") {
      // rest of code
     } }) UPDATED: Pastie Database https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=465 UPDATED: Save and Scooby Doo https://haversineconsulting.quickbase.com/db/bkjdxnw2x?a=nwr
    FWIW, I work mostly in Chrome today and occasionally don't even test my code in Internet Explorer. However, almost all of my code is tested in Chrome before I post a demo or answer. If you encounter a problem there may be some isolated cases where I overlooked something but there is almost always a fix. This particular problem was intermittent in Internet Explorer and FireFox so apparently when I looked at it previously I never discover it myself.
    • MiguelSoto's avatar
      MiguelSoto
      Qrew Trainee
      do you know why the message its showing before the save it show just on load the form



      ------------------------------
      Miguel Soto
      ------------------------------
  • somewhat related to this, as I'm trying to implement it... I'm wanting to get the values of fields to then use them later in my JS code...

    Dan, you mentioned that $("#_fid_6").is (":checked") is how to check if a checkbox is checked... What is the notation to be able to get the actual value of a text field?
  • Thanks so much for writing about this technique. Is there a way to get it to work on the mobile site? If I view the demo at the start of this thread on mobile, the example doesn't work - just like how it doesn't work with my own application when on the mobile site. Any help with this would be very much appreciated.