Discussions

 View Only
  • 1.  Javascript popup in new supported way

    Posted 01-03-2023 15:19
    I have a field that has javascript embedded in it to provide a confirmation to the user when they acknowledge via a button.  The code is at the end of this post.

    How do I do this in the new approved javascript format?  I guess I need a code page but I basically searched the internet to get this to work, I am not really familiar with javascript.  I dont know how to call a code page or if I just simple move this javascript into it and make it a js file?

    var text URL = URLRoot() & "db/" & [_DBID_THE_ELITE_WAY_VIEWS] &
    "?a=API_AddRecord" &
    "&_fid_6=" & URLEncode ([Record ID#]) &
    "&apptoken=HIDDENFORSECURITY" &
    "&_fid_8=" & URLEncode(User()) &
    "&_fid_10=" & URLEncode(Today());

    "javascript:" &"$.get('" & $URL & "',function(){" &"location.reload(true);" &"});" & "void(0);alert('Confirmed');"

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


  • 2.  RE: Javascript popup in new supported way

    Posted 01-03-2023 16:34
    Edited by Mark Shnier (Your Quickbase Coach) 01-03-2023 16:34
    If you are just looking to execute a URL and refresh the page, this here is sample syntax.  But it will not do a pop up.

    var text Approve = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & ToText([Record ID#])
    & "&_fid_144=Approved";

    var text RefreshPage = URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl();

     
    $Approve
    & "&rdr=" & URLEncode($RefreshPage)

    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: Javascript popup in new supported way

    Posted 01-03-2023 16:50

    I do want to alert the user that the button executed.  Vs just the page blinking as it refreshes.

     

    Ivan J. Weiss, CFSP | President & COO elite|studio e

    631.949.6635 www.elitestudioe.com

     

    Connect with us. LinkedIn | Instagram

     

    Please click this link to see my availability for calls:  https://calendly.com/ivanweiss

    CONFIDENTIALITY NOTICE: The information contained in this transmission is intended for the named receiver only. The transmission may contain privileged and confidential material. If you are not the named recipient, please be advised that any use, dissemination or unauthorized copying of the material contained within is strictly prohibited. If you have received this transmission in error, please notify elite | studio e immediately and delete the received transmission. Thank you.






  • 4.  RE: Javascript popup in new supported way

    Posted 01-03-2023 16:51
    .. I don't have an answer for that .....

    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------



  • 5.  RE: Javascript popup in new supported way

    Posted 01-04-2023 06:27
    What is the new approved javascript format @Ivan Weiss​ ?

    ------------------------------
    Prashant Maheshwari
    ------------------------------



  • 6.  RE: Javascript popup in new supported way

    Posted 01-04-2023 08:59
    Where we cannot have javascript in the formula url field and it needs to be in a code page

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



  • 7.  RE: Javascript popup in new supported way

    Posted 01-04-2023 09:38
    We have a checkbox that gets checked when the button is clicked as part of the url. Then we surround that with an IF statement. When the checkbox is checked we can show/hide the button, or change the color of the button, or change the name written in the button based upon the state of the checkbox. That seems to give Users enough feedback.

    ------------------------------
    Jim Harrison
    transparency = knowledge + understanding : The Scrum Dudes
    ------------------------------



  • 8.  RE: Javascript popup in new supported way

    Posted 01-05-2023 08:32
    Jim, you are probably right.  That is probably the way to do it.  I can also setup a pipeline so that if the training is updated that checkbox clears to ensure the user is prompted again to review it.

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



  • 9.  RE: Javascript popup in new supported way

    Posted 01-06-2023 11:18
    For reference, here is the official Quickbase code page app that has samples of using js and code pages:

    Quickbase Code Page App

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