How can I not refresh the page after a URL-Formula button is pressed?

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered
I am using the following URL-Formula button to edit a field and use the CopyMasterDetail API. At the very end, it is refreshing the current record but I would like it NOT to refresh - reason being, I am using this button in a report and do not want to lose my place.

How can I revise my formula to accomplish this?

var text EditDateTime = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=token&rid=" & ToText([Record ID#]) & "&_fid_546=" & URLEncode(Now());

var text CopyParentChild = URLRoot() & "db/" & Dbid()  
& "?a=API_CopyMasterDetail"
& "&relfids=91"
& "&copyFid=547"
& "&destrid=" & [Record ID#]
& "&apptoken=token"
& "&sourcerid=" & [Product - Template ID];

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

$EditDateTime  
& "&rdr=" & URLEncode($CopyParentChild)
& URLEncode("&rdr=" & URLEncode($DisplayRecord))
Photo of NP

NP

  • 10 Points

Posted 4 years ago

  • 0
  • 1
If no one posts a better solution, you could check the box to open the URL in a new window.  Then you would not lose your place on the report.

There is code to have a page execute a URL and not refresh, that looks like below, but I have never been able to make it work when the URL has "redirects" in it.  ie  stringing together successive actions.

Basically, you just change the formula variable for the URL and the pop up words and then don't mess with the rest.

But this will not answer your question as your URL has Redirects in it.


var text URL = URLRoot() & "db/" & "?act=API_EditRecord&_fid_80=1&rid=" & [Record ID#];

"javascript:" &
"$.get('" &
$url &
"',function(){" &
"$.jGrowl('This Item has been put on PO CANCEL snooze', {life: 5000, theme: 'jGrowl-green'});" &
"});" &
"void(0);"
Photo of NP

NP

  • 10 Points
I'm not quite sure where to place that code within my current formula.
That code was just FYI.  It was not an Answer to your question as i said in my post that the concept that I posed will only work if you do not have redirects in your URL.

My only suggestion is to check the box in the field properties for your existing URL formula field to open your existing URL in a new window.  Then you will not lose your place in the existing window.
Photo of Harrison Hersch (MCF)

Harrison Hersch (MCF), Champion

  • 40 Points
In order to do this, you would need to use some custom JavaScript. It would then do a sort of ajax call to QuickBase and the user would never lose their place. It would require injecting some custom code.