Discussions

Expand all | Collapse all

URL button code

  • 1.  URL button code

    Posted 12-12-2019 15:12
    I used something I found in magic buttons to create a button that allows an EOTI user to submit a form and then direct to a 'Request Received" html page. This button automatically saves and redirects because my form automatically saves child records.

    I before it saves and redirects, I would like a display box to come up that says something like "Have you added photos?"  (or other possible messages) and the user can say cancel or confirm submission. 

    Cancel would of course put them back on edit mode, and confirm would direct them to the received.html page.

    How can I do this?

    Thanks.

    ------------------------------
    Mike Tamoush
    ------------------------------


  • 2.  RE: URL button code

    Posted 12-12-2019 15:36
    Check this video from Kirk Trachy out:

    Pop up messages

    ------------------------------
    Adam Keever
    ------------------------------



  • 3.  RE: URL button code

    Posted 12-12-2019 18:12
    Thanks for the link, some good info for sure. For my use case, I don't think I can adapt. Those display messages are using form rules for drop down menus, etc. I need to add code to a button and also allow for canceling, or saving within that code, from the pop up message itself.

    ------------------------------
    Mike Tamoush
    ------------------------------



  • 4.  RE: URL button code

    Posted 12-12-2019 17:02
    Edited by Adam Keever 12-12-2019 17:03
    I'm glad you asked this question. After having seen Kirk's video and pondered your use case, I found that you can add an HTML button with an href to the URL of an HTML button to edit fields in a form and redirect back to the same form in edit mode.

    First I made a formula rich text button to fill in the status as "Approved" and log the approval date:
    "<a style=\" text-decoration: none; background: #00ff00; border: 10px solid #00ff00; border-radius: 3px; color: #000000; display: inline-block; font: normal 700 20px/1 \"Calibri\", sans-serif; text-align: center; text-shadow: none; href='"&
    URLRoot() & "db/" & Dbid() & "?\n\na=API_EditRecord&apptoken=YOUR_TOKEN_HERE &rid=" & URLEncode ([Record ID#])

    & "&_fid_20=Approved"
    & "&_fid_19="& "Today"

    &"&rdr=" & URLEncode(

    URLRoot() & "db/" & Dbid() & "?a=er&rid=" & [Record ID#]) & "''>Approve</a>"

    Next I added a dynamic form rule to display a message when the date field is not equal to blank and used this in the message body:
    <a style= "text-decoration: none; background: #00ff00; border: 10px solid #00ff00; border-radius: 3px; color: #000000; display: inline-block; font: normal 700 20px/1 "Calibri", sans-serif; text-align: center; text-shadow: none; href="https://YOUR_REALM.quickbase.com/db/YOUR_DBID?a=API_EditRecord&apptoken=YOUR_APP_TOKEN%20&rid=3&_fid_20=Approved&_fid_19=Today&rdr=https%3A%2F%2FYOUR_REALM.quickbase.com%2Fdb%2FYOUR_DBID%3Fa%3Der%26rid%3D3">Approve</a>

    When date is blank:

    When date is not blank:

    After clicking the Approve button:

    So the button is working, but I need to figure out how to save&keep working before the other actions...

    Maybe tomorrow.



    ------------------------------
    Adam Keever
    ------------------------------



  • 5.  RE: URL button code

    Posted 12-12-2019 18:13
    I didn't refresh my screen and see this other response before I replied! I'll read through it and see if I can adapt.

    ------------------------------
    Mike Tamoush
    ------------------------------



  • 6.  RE: URL button code

    Posted 12-13-2019 15:07
    Good news is that I got this to work, bad news is that it only works for one record ID since the HTML will only interpret static references and does not compile URLRoot(), Dbid(), and [Record ID#] functions and attributes....

    Date field is empty:

    Message displayed when date field is not empty:
    Result:

    And here is the code that performs this:
    <a style= "text-decoration: none; background: #00ff00; border: 10px solid #00ff00; border-radius: 3px; color: #000000; display: inline-block; font: normal 700 20px/1 "Calibri", sans-serif; text-align: center; text-shadow: none; onclick='$("#saveAndKeepWorkingMenuOption").click();' href=https://YOUR_REALM.quickbase.com/db/YOUR_DBID?a=API_EditRecord&apptoken=YOUR_APP_TOKEN&_fid_20=Approved&_fid_19=Today&rid=3&rdr=https%3A%2F%2FYOUR_REALM.quickbase.com%2Fdb%2FYOUR_DBID%3Fa%3Der%26rid%3D3">Approve</a>


    ------------------------------
    Adam Keever
    ------------------------------