Discussions

Expand all | Collapse all

URL Formula Button Refresh current page not Redirect

dwhawe dwhawe03-11-2014 16:16

QuickBaseCoach Dev./Training03-11-2014 16:21

Xavier Fan03-12-2014 17:40

Drew Voge03-17-2014 00:10

Kerry-Ann Kerry-Ann04-18-2016 20:48

  • 1.  URL Formula Button Refresh current page not Redirect

    Posted 03-11-2014 14:45
    What I have now is an application dashboard for our Director to select a name of a manager. Then it takes them to individual Dashboards with ALL of the reports for that one manager on the page for employee performance metrics (measured across multiple tables and entry points). One report on the dashboard is a "Address at the next 1:1" list. On the report i have a URL button field that changes the status from "Address" to "Closed" so that the director can just click on the button without editing each record every time just to change status and save. One click entry without leaving the dashboard view.

    Since i cannot redirect to the main table dashboard (since she would have to select the name and re-enter the specific employees dashboard). I would like for the page to just refresh itself on the current dashboard. Keep in mind that i cannot code a specific dashboard since there are 40+employee dashboards each with a different URL that utilize the same table, but different reports.



    Here is what i have:

    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]

    & "&_fid_12="&URLEncode("Closed")


    & "&rdr=" & URLEncode(URLRoot() & "db/INSERT THE MAIN TABLE ID YOU CAN FIND THIS BY CLICKING HOME") <--I cannot use this because i want to just refresh current page





    Found this suggestion on further research, but it gives me "Formula Syntax Errors" when i add this to the bottom of the code below

    "javascript:" &

    "$.get('" &


    $URL &


    "',function(){" &


    "location.reload(true);" &


    "});"


    & "void(0);"




    Any help is greatly appreciated



  • 2.  RE: URL Formula Button Refresh current page not Redirect

    Posted 03-11-2014 14:49
    Xavier Fan posted that info and while I have not tested it yet myself, it should work.



    Try this and do my testing for me. make a formula variable to define $URL and then the code should work. Let us know how it goes.


    var URL =


    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]

    & "&_fid_12="&URLEncode("Closed");

    "javascript:" &

    "$.get('" &


    $URL &


    "',function(){" &


    "location.reload(true);" &


    "});"


    & "void(0);


  • 3.  RE: URL Formula Button Refresh current page not Redirect

    Posted 03-11-2014 15:31
    That is the exact problem i am having.  I am not able to find anything that will define the $URL as the current page we are on now. I keep getting syntax errors when i use this.. Something else i just tried

    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_12="&URLEncode("Closed")
    & "&rdr=" & URLEncode(URLRoot() & "javascript:location.reload(true))")  <-but the java is not able to be used like that, but at least i get to a 404 error page and can hit my back button.   

    Any other ideas to define $URL as the current page?


    The above sample did not work.

    var URL = ??******MISSING FORMULA TO DEFINE THE CURRENT PAGE URL*******??

    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]

    & "&_fid_12="&URLEncode("Closed");

    "javascript:" &

    "$.get('" &

    $URL &

    "',function(){" &

    "location.reload(true);" &

    "});"

    & "void(0);"


  • 4.  RE: URL Formula Button Refresh current page not Redirect

    Posted 03-11-2014 16:10
    You did not try what I suggested.
    I gave you the exact code to try but it had a small syntax error.  This is tested.


    var text URL =
    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_12="&URLEncode("Closed");

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


  • 5.  RE: URL Formula Button Refresh current page not Redirect

    Posted 08-15-2017 18:31
    I have noticed that this code doesn't always work for some reason. It's not consistent, but when the button is clicked, the form or report is just refreshed but the action is not performed. Have you experienced this at all or have any idea why that would be? This happens regardless of which browser is being used.


  • 6.  RE: URL Formula Button Refresh current page not Redirect

    Posted 08-15-2017 19:22
    Juan
    You should clearly state your question in a new post and perhaps just reference this post with a link as we have no idea what your code is.


  • 7.  RE: URL Formula Button Refresh current page not Redirect

    Posted 08-15-2017 19:28
    Sorry, I was just referring to the example to which I added my comment:

    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_12="&URLEncode("Closed");

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

    I noticed that the edit action does not always get executed, although the refresh (reload) does. Sometimes the records just don't get updated.

    I'll create a new post if I still need an answer. Thanks!


  • 8.  RE: URL Formula Button Refresh current page not Redirect

    Posted 08-15-2017 19:40
    Try this
    var text URL = 
    URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_12="&URLEncode("Closed");

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


  • 9.  RE: URL Formula Button Refresh current page not Redirect

    Posted 08-15-2017 19:48
    You'll need an apptoken


  • 10.  RE: URL Formula Button Refresh current page not Redirect

    Posted 08-15-2017 19:54
    Also, note that you should only show the button in Edit or View mode.  You cannot edit a record which does not yet exist.


  • 11.  RE: URL Formula Button Refresh current page not Redirect

    Posted 03-11-2014 16:16
    This worked for me


  • 12.  RE: URL Formula Button Refresh current page not Redirect

    Posted 03-11-2014 16:21
    Yes, its a really handy technique now!


  • 13.  RE: URL Formula Button Refresh current page not Redirect

    Posted 03-12-2014 17:40
    Glad it worked!


  • 14.  RE: URL Formula Button Refresh current page not Redirect

    Posted 03-17-2014 00:10
    This is so very extremely helpful.


  • 15.  RE: URL Formula Button Refresh current page not Redirect

    Posted 03-17-2014 16:01
    This solution did work.  Thank you so much for all of your help!!


  • 16.  RE: URL Formula Button Refresh current page not Redirect

    Posted 04-18-2016 19:34
    Hi, Can you explain how I would set this up with a status change button?


  • 17.  RE: URL Formula Button Refresh current page not Redirect

    Posted 04-18-2016 19:37
    Kerry-Ann
    Did you try code like this?

    var text URL =
    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_12="&URLEncode("Closed");

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

    In that example, the field being updated is field ID#12


  • 18.  RE: URL Formula Button Refresh current page not Redirect

    Posted 04-18-2016 19:39
    I have an if statements set up, like the following, how would I apply this java to this?

    If([Status]="Ready to Start",
    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=b2ef6ijciijsibdf9dftgdjtdhm3"
    & "&_fid_15="&URLEncode("In Progress")
    & "&_fid_284="&URLEncode(Today())
    & "&rdr=" & URLEncode(URLRoot() & "db/bkpvkgvbb"),

    [Status]="In Progress",
    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=b2ef6ijciijsibdf9dftgdjtdhm3"
    & "&_fid_15="&URLEncode("Completed")
    & "&_fid_285="&URLEncode(Today())
    & "&rdr=" & URLEncode(URLRoot() & "db/bkpvkgvbb")
    & "&_fid_29="&URLEncode(Today()), null)


  • 19.  RE: URL Formula Button Refresh current page not Redirect

    Posted 04-18-2016 19:55
    OK, so now I am confused as to what you real question is.

    What are you trying to do that is not working?  This technique does not support the "rdr=" ....


  • 20.  RE: URL Formula Button Refresh current page not Redirect

    Posted 04-18-2016 20:32
    Sorry. I really just want each time a person clicks to change the status button that the page refresh and stay on the same page. Can I still use this code? If so, how would I use it?


  • 21.  RE: URL Formula Button Refresh current page not Redirect

    Posted 04-18-2016 20:40
    Try this
    var text URL =
    If([Status]="Ready to Start",
    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=b2ef6ijciijsibdf9dftgdjtdhm3"
    & "&_fid_15="&URLEncode("In Progress")
    & "&_fid_284="&URLEncode(Today()),

    [Status]="In Progress",
    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=b2ef6ijciijsibdf9dftgdjtdhm3"
    & "&_fid_15="&URLEncode("Completed")
    & "&_fid_285="&URLEncode(Today())
    & "&_fid_29="&URLEncode(Today()));


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

    please check the code for the In progress - are you wanting to update two different date fields?


  • 22.  RE: URL Formula Button Refresh current page not Redirect

    Posted 04-18-2016 20:48
    That worked perfectly! Thank you so much!


  • 23.  RE: URL Formula Button Refresh current page not Redirect

    Posted 04-18-2016 20:59
    :) the nice thing about that technique is that it will work on any record or report and not need multiple buttons.


  • 24.  RE: URL Formula Button Refresh current page not Redirect

    Posted 04-06-2017 14:52
    Hi Everyone:

    Would this be sufficient to have the auto refresh happen?

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

    Or does it need the everything that proceeded?  This is what my existing button looks like:

    var  text  pdfid = Case([Company], "UMB", "8", "9");var  text  fname = Case([Company], "UMB", "UMB Assignment Form", "Assignment Form");
    "javascript:void(window.open('" &
    "https://www.aws-juiced-client2.com/CompleteMedical_946/PDF Stamper/Default.aspx?"
    & "clientid=Q946"
    & "&appid=bkkhaw4q7"
    & "&msdb=" & Dbid()
    & "&msid=" & [Patient Number]
    & "&tpdbid=" & [_DBID_DOCUMENT_TEMPLATES]
    & "&tpid="  &$pdfid
    & "&faid=444"
    & "&apptoken=cidsvuqba48bsbbdntgghv5dzec"
    & "&fn="&$fname
    & "&pdfdte="
    & "&rsfid=14"
    &"','copy','top=40,left=320,width=730,location=no,menubar=no,toolbar=no,status=yes'))"


    So should I just add the javascript after that?  

    Thanks in advance!


  • 25.  RE: URL Formula Button Refresh current page not Redirect

    Posted 04-06-2017 15:47
    I could be wrong, but I don't think you can run 2 JavaScript actions in one button...
    In this situation I don't think you'll be able to use the standard reload with this.

    You main formula is already using a "window.open" call, so you would need to include a close function as part of that main call.

    something like
    {if (a.closed) {window.location.reload();}}

    but I'm not 100% of the syntax in your situation.


  • 26.  RE: URL Formula Button Refresh current page not Redirect

    Posted 04-06-2017 15:52
    The developer I'm working with found a workaround.  THANKS!


  • 27.  RE: URL Formula Button Refresh current page not Redirect

    Posted 07-26-2017 20:12
    I'm interested in modifying the javascript above to include a location redirect in the script. 

    var text DisplayRecord=
    URLRoot() & "db/" & [_DBID_TASKS_POC]
    & "?a=td";

    "javascript:" & 
    "$.get('" & $AddRecordOne & "').then(function(){" &
    "$.get('" & $AddRecordTwo & "').then(function(){" &
    "$.get('" & $AddRecordThree & "').then(function(){" &
    "$.get('" & $AddRecordFour & "').then(function(){" & 
    "$.get('" & $AddRecordFive & "').then(function(){" &
    "$.get('" & $AddRecordSix & "').then(function(){" &
    "$.get('" & $AddRecordSeven & "').then(function(){" &
    "$.get('" & $AddRecordEight & "').then(function(){" &
    "$.get('" & $AddRecordNine & "').then(function(){" &
    "$.get('" & $AddRecordTen & "').then(function(){" &
    "})" & 
    "})" & 
    "})" & 
    "})" & 
    "})" & 
    "})" & 
    "})" & 
    "})" & 
    "})" & 
    "});"
    & "void(0);"

    Where do I insert $DisplayRecord? I've tried numerous different spots, can't get it to work. Thanks in advance!