Discussions

Expand all | Collapse all

Confirm Popup and if "OK"" execute API

  • 1.  Confirm Popup and if "OK"" execute API

    Posted 08-20-2021 18:48

    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
    ------------------------------


  • 2.  RE: Confirm Popup and if "OK"" execute API

    Posted 08-21-2021 07:14
    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
    ------------------------------



  • 3.  RE: Confirm Popup and if "OK"" execute API

    Posted 08-21-2021 12:29
    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
    ------------------------------



  • 4.  RE: Confirm Popup and if "OK"" execute API

    Posted 08-23-2021 12:00
    Edited by Evan Martinez 08-23-2021 12:21
    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
    ------------------------------



  • 5.  RE: Confirm Popup and if "OK"" execute API

    Posted 08-23-2021 17:15

    Alright, Thank You! 



    ------------------------------
    Devin Jackson
    ------------------------------



  • 6.  RE: Confirm Popup and if "OK"" execute API

    Posted 08-23-2021 17:17

    This is a big help!

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

    Best,



    ------------------------------
    Devin Jackson
    ------------------------------