Skip to main content
Question

Return to page after Edit Record formula text button.

  • April 17, 2017
  • 0 replies
  • 93 views

I use the code:
"javascript:" &
"$.get('" & 

$URLONE &

"',function(){" &

"location.reload(true);" &

"});" 

& "void(0);"

to return to the same page a lot in my app and it works incredibly well.  However I only use it on formula URL's and I am wondering what I need to change to make it work on a formula text button instead.  Here is the code:


var text URLONE = "<a class='Vibrant Success' href=" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#]  & "&_fid_56=true" & "> IA Documents Approved </a>";

"javascript:" &

"$.get('" & 

$URLONE &

"',function(){" &

"location.reload(true);" &

"});" 

& "void(0);"

Does this code need to be in a formula URL or is there a better way to refresh the page after editing the record?  Thanks in advance.
This topic has been closed for replies.

  • Registered
  • April 17, 2017
The java reload syntax needs to be part of your href in the formula text button.  Or you can make a formula URL field that has all the action, and just reference it in the formula text field.

"<a class='Vibrant Success' href=' " & [URL Formula Field] & " '> IA Documents Approved </a>"

fwiw, i have never been able to get the javascript reload working in conjunction with those href Vibrant buttons, so I'm sitting on the sidelines here to see if it can be done.

I have it working when a "redirect" (rdr) is used but not for the more useful javascript refresh syntax.  (ie more useful as it works universally regardless of if you are on a record or a report).

  • Registered
  • April 17, 2017
Correction to the syntax, I copied the wrong button.

If you want the reload to happen within the formula text button you have to nest the quotes.

With Reload java:
href=\""&[URL Formula Field]&"\"

with a RDR:
href=' " & [URL Formula Field] & " '

Sorry if that throws you off.

Forum|alt.badge.img+12
  • Registered
  • April 17, 2017
Generally, to use color-buttons I use a button for "View" mode (reports and view-form layouts) and a separate one for Edit.  The color choice of the button would be Success (green), Danger (red) and Primary (blue).

For Edit-Mode

  "<a class='Vibrant Success' title='Start' href='#' style='text-align:center; display:block' onclick=\"" & "javascript:$(function(){window.location.href='" &
  URLRoot() & "db/" & [_DBID_TABLE_ALIAS] & "?act=API_EditRecord&apptoken=xxxxxxxxxx&rid=" & URLEncode([Record ID#])
  & "&_fid_6=" & URLEncode("Text")
  & "&_fid_8=" & URLEncode(User())  
  & "&_fid_7=" & URLEncode(Now())
  & "&rdr=' + escape(window.location); return false;});"
  &"\">Button Label Here</a>"

For View-Mode/Reports

"<a class='Vibrant Success' title='Start' style='text-align:center; text-decoration:none' href='javascript:void(window.location.href = \"" & 
  URLRoot() & "db/" & [_DBID_TABLE_ALIAS] & "?act=API_EditRecord&apptoken=xxxxxx&rid=" & URLEncode([Record ID#])
  & "&_fid_6=" & URLEncode("Text")
  & "&_fid_8=" & URLEncode(User())  
  & "&_fid_7=" & URLEncode(Now())
  & "&rdr=' + escape(window.location); return false;});"
  &"\">Button Label Here</a>"

Hope this is helpful.

Laura, thx for wading in with a most useful answer.

  • Author
  • Registered
  • April 17, 2017
Thank you all for your responses.  These answers will definitely solve some of the issues that I am having right now.  See you all at Empower in a month!