Forum Discussion

EOMDevelepors's avatar
EOMDevelepors
Qrew Captain
5 years ago

Sweetalert

I started to use sweet alerts in Quickbase and I am loving it. I wanted to get it to work with sweetalert2 and I am having a hard time.

Can anyone help me how to add the script in the pages I want to use sweetalert2?

below is the instruction page from sweetalert2.

Thanks

https://sweetalert2.github.io/#download

11 Replies

  • Can you be more specific about what you mean by adding the script pages? Where / how are you using it currently?

    Are you using dbpages or are these built into a button in your app using $.getScript or something equivalent?

    Just a thought  - If you're currently using the original library make sure you swap out the script tags and actually remove the original ones so they don't conflict with one another. 

    Chayce Duncan | Director of Strategic Solutions
    (720) 739-1406 | chayceduncan@quandarycg.com
    Quandary Knowledge Base
  • First thanks for the reply.

    I added to my bol code page the following where the old sweetalert script is commented out. However the new one does not appear to work. :

    //var s = document.createElement("script");
    //s.src = "https://unpkg.com/sweetalert/dist/sweetalert.min.js";
    //document.getElementsByTagName('head')[0].appendChild(s);

    var s2 = document.createElement("script");
    s2.src = "https://cdn.jsdelivr.net/npm/sweetalert2@8";
    document.getElementsByTagName('head')[0].appendChild(s2); 

    The installation instruction states that in order to use sweetalert2 yuo need to include another script to the page that calls for the sweetalert2 methods.

    My question is how to I append that to my js page in order for it to work.

    I think that this is a powerful tool for any developer instead of using the js prompt() and alert()

    Thanks again
    • AustinK's avatar
      AustinK
      Qrew Commander
      Have you tried different links? Try a different cdn link or even host the file yourself in QuickBase on an attachments table. If it was previously working then this should work as well.

      https://cdnjs.com/libraries/limonte-sweetalert2 - I think this is the same library. Try one of the links there, like the min link.
    • EOMDevelepors's avatar
      EOMDevelepors
      Qrew Captain
      Thanks for the reply. How would I reference it and use it once I host it as a file attachment in QB?

      Thanks
  • In any case even with the original sweetalert seems like it is conflicting with angular: 

    angular.min.js:7 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.21/$injector/modulerr?p0=qb.connect.logout&p1=Error%3A%20%5B%24i...
        at angular.min.js:7
        at angular.min.js:35
        at q (angular.min.js:8)
        at e (angular.min.js:34)
        at gc (angular.min.js:37)
        at c (angular.min.js:19)
        at Object.fc [as bootstrap] (angular.min.js:19)
        at common.packed.js:2456
        at Object.execCb (common.packed.js:29)
        at $.check (common.packed.js:18)