Forum Discussion

DevinJackson's avatar
DevinJackson
Qrew Member
3 years ago

Confirm Popup and if "OK"" execute API

I am looking to create a Pop-Up that requests a confirmation before an action is taken. 

I created a button that toggles a box to initiate a notification send out to our Candidates (code below). This works great.

var number newToggleValue = If([test_box]=true,0,1);

var text urlOne = URLRoot() & "db/" & Dbid()
& "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_28=" & $newToggleValue
& "&apptoken=XXXXXXX";

var text urlTwo = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

$urlOne
& "&rdr=" & URLEncode($URLTWO)
_____________________________

But I would like to have the button request confirmation that the user wanted to press the button. So we don't send out emails accidentally. 

Something like: 

If button is pressed, display "Are you sure you want to send notification?" with options "Send" and "Cancel". 

If Send, $urlOne & "&rdr=" & URLEncode($URLTWO)

If Cancel, do nothing and close popup.

All resources I have found on this discuss using Javascript in a URL Formula Field back in 2019, and I know QuickBase does not take Javascript atm, whether it did in the past I do not know. Any thoughts on how to accomplish this now?



------------------------------
Devin Jackson
Director of Operations
MedMatch
------------------------------

5 Replies

  • We have a low tech solution which is certainly doable and practical, but not as elegant as a pop up.

    Make a button which simply displays the same record on a super mini form. The form will have a very few bare bones fields to identify the record and then two buttons.

    then a message saying "Are you sure that you want to .... whatever "like start a nuclear Armageddon" or in your case .  "Send out Candidate emails".  

    One button might be red called CANCEL!  That would just redisplay the original record on the full form.  The other button would do the API and land the user back on the full form.

    So basically not a pop up but just making the user do an extra click to get to an alternate form to send the email.

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • DevinJackson's avatar
      DevinJackson
      Qrew Member

      Alright, Thank You! 



      ------------------------------
      Devin Jackson
      ------------------------------
  • Hi Devin,

    In our Code Page Sample App we do have a code page example that fires off a button that takes users to a PromptAndRefresh code page. On the code page it prompts for user input, edits the record with user input, and refreshes the initial page. For the example, the API call is defined in the URL and passed through to the code page and waits for user input prior to completing the API call.

    I believe something similar could be done with your prompt to send an email by having a field hidden from the user that asks for a confirmation of something like YES in a text field or checking a checkbox and saving. They would click the button, popup into the code page to put in whatever prompt you would like to confirm, and then hit save. That would then trigger the notification on the back end via that API before refreshing the page where they started. It might take a little tinkering in code pages but should give you a very similar flow.

    ------------------------------
    Evan Martinez
    ------------------------------
    • DevinJackson's avatar
      DevinJackson
      Qrew Member

      This is a big help!

      Great resource, and gives me a handful of ideas to solve the issue. Appreciate it!

      Best,



      ------------------------------
      Devin Jackson
      ------------------------------
  • Following as I have some of that old javascript code I need to replace once a solution is figured out.  I really wish pop up alerts were a default option in quick base

    ------------------------------
    Ivan Weiss
    ------------------------------