Forum Discussion

TroyMaharg's avatar
TroyMaharg
Qrew Trainee
8 years ago

Disable popup that reads ""Save this record?

I understand that overriding the safety measures that QB has put in place is not a good idea but I feel there are always exceptions to the rules.  I have a table in which I have fields that the user inputs information into and with a button click I create the child records, except there is popup that comes up and drives my users mad. These fields are cleared out upon save so I am not concerned about loss of data.  Saving Parent record option does not work as it causes issues with my code.
  • So are you saying that using to checkbox to automatically save the record when navigating away or adding children manually does not work in your use case?
  • Have you tried the setting in Advanced Settings on the table to automatically save the parent when adding a child? Not sure if this applies to your workflow without more details though.
  • I'm not using a checkbox to automatically save the record, I really don't need the record to save I just need the values for that instance.  I have field where the user can input the number of units in a building which tells me how many child records to create, then they use a grid edit report located in the table to complete everything.  I tried using the save parent when adding a child but when the user clicks the button it does an automatic save then calls my code page which will mess up.  Hope this make sense.
  • After doing some searching and rework I was able to get around this issue by implementing Dan Diebolt Save and Scooby Doo Technique.
  • FWIW, there are a couple of other things you can do:

    (1) Simply noop QuickBase's ConfirmLinkAway function by redefining it with no body: 

    function ConfirmLinkAway(){} 
    (2) Define a Mutation Observer so that when the dialog appears your code immediately clicks on the Save button. 

    $(function(){
      var observer = new MutationObserver(function(mutations) {
        
        mutations.forEach(function(mutation) {
          if (mutation.type == "childList" && mutation.target.getAttribute("id") == "dialogLinkAway") {
            $("#dialogLinkAway button:contains(Save)").click();
          }
        });
      });
      var body = document.body;
      
      var config = {
        childList: true,
        subtree: true
      };
      observer.observe(body, config);
    });

    I didn't test this code but it should work. See this example of a Mutation Observer that focused on the Save button when a certain Form Rule Dialog Box appeared:

    Form Rule Message Box - Dismiss With Enter Rather Than Click
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=274
  • Thanks for the response Dan, I haven't tried this out yet but I will.  Your Save and Scooby Doo Technique is awesome and actually worked out better for this situation.
  • JackFretwell's avatar
    JackFretwell
    Qrew Assistant Captain
    New to this and seeing something similar, I want a form to hold temp values until we have an invoice that is suitable, when I update fields we get a message box asking to save so all values are lost.
    Where should the code "function ConfirmLinkAway(){}" be stored?  In the table, form, code page and how should it be called?
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      Script is saved in code pages and accessed from you QuickBase pages using a script injection technique such as IOL. You can read about the IOL technique here:

      https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=294

      By placing this code 
      function ConfirmLinkAway(){}
      in you script you are redefining QuickBase's authored function named ConfirmLinkAway to do nothing. It is a little know fact that you can redefine any function even those authored by QuickBase. In general redefining functions is not a good idea but we are in the world of workarounds here. This situation reminds me of this play:

      She Stoops to Conquer


      Beyond that ask a new question concerning your specific need and context.