Skip to main content
Question

Formula URL or Formula Text Button that will perform an action, without the need to navigate away from the current dashboard/report/record?

  • April 20, 2017
  • 0 replies
  • 341 views

Can I create a Formula URL or Formula Text Button that will perform an action, without the need to navigate away from the current dashboard/report/record??

I have several checkboxes/dates/users that are stored via a Formula-Text button (I like to put images on the buttons instead of the normal gray ones). However, when clicked these must navigate away and redirect somewhere.

Is there a way to avoid this, being able to click the button and have it execute the command (API_EditRecord) without having to refresh the page. 
This topic has been closed for replies.

This format will work on a record or a report.

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);"

The 5000 means it will display the pop up for 5 seconds before it fades away on its own.

I have never tried this on a dashboard in part because the button needs to know which record to act on.

  • Registered
  • April 22, 2017

Carlos,

Did you do anything differently to the code to make the buttons work in your reports? I applied the apptoken parameter to the query string and the buttons work with apptokens enabled, but in a report the buttons do not work.

Chris


The buttons should work identically on a report or form.

I modified and used in my report but pressing the button shows no reaction.
my fid is 10 and it's a checkbox. I simply want to be able to press the button in a report to mark the checkbox checked because I don't want to have to use "grid edit" which would render another button I have (to open at the URL of the record in a new window) useless.
var text Update= URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & ToText([Record ID#]) & "&_fid_10=1";
var text URL = "javascript:" &"$.get('" & $Update & "',function(){" &"$.jGrowl(�Item Marked Completed�, {life: 5000, theme: 'jGrowl-green'});" &"});" &
"void(0);";
"<a class='Vibrant Danger' href=\"" & $URL &"\"" & ">Mark Completed" & "</a>"

To test this, I suggest that you make a temporary formula URL field with just this.

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

My guess is that when you click that it will fail on something, likely a complaint about the application token is missing.

I suggest that you then go to the settings for the App  and then Advanced settings and either disable the need for Application Tokens or else create one and include the extra line

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & ToText([Record ID#]) & "&_fid_10=1"
& "&apptoken=xxxxxxxxxxxx

Thanks Coach. The Formula URL button did show it needed an app token, and now the test button works fine (although it shows the XML result and doesn't finish the button, refresh and return to the same report screen).
So while that line was fixed, the next two don't work either. When I click the button nothing happens, so there clearly are issues with the next two lines of code.

Perhaps I need to load the jGrowl first? I don't see that in this thread but I've toyed with other people's code (like the tabbed forms) and used an "onload" field to load the javascript..I"m a newbie and can't really code in javascript, I can just tweak simple stuff from other people sometimes.

I know that this will work, but the button will be grey.  I'm not sure that I have working code  to easily post to get the jgrowl to work as a Vibrant colored button.



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);

Can you post your current code that is not working?

This is what I had before your last post in a formula-text button

var text Update=URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & ToText([Record ID#]) & "&_fid_10=1"& "&apptoken=xxxxxxxxx";

var text URL = "javascript:" &"$.get('" & $Update & "',function(){" &"$.jGrowl(�Item Marked Completed�, {life: 5000, theme: 'jGrowl-green'});" &"});" &"void(0);";

"<a class='Vibrant Danger' href=\"" & $URL &"\"" & ">Mark Completed" &  "</a>"

Do I have to onload anything? Does the jGrowl just work?

No there is no onload required.

I see the problem.  :)

�Item Marked Completed�, 

Those quotes in your formula are curly  66 99 type quotes that get generated typically by Word.

The need to be the ' kind of  single quote.  ie not � � and but a ' and '.

ARGH!  That keeps happening to me and I figured out that was happening but thought I fixed them all. Thanks for catching it. In my case it's a mac "Notes" app where I keep all my code. I'll have to stop using it once-and-for-all. Gracias!

:) That Syntax to get a jgrowl Vibrant button is particularly difficult.  

I keep my cheat notes for code snippets in QuickBase back where it is easily searchable and always handy when I'm on line developing.

It works great....I would just want to get it to refresh the page if possible? Although that would probably make the jGrowl not very useful....

:)  One per customer.  You get to choose a page refresh or the pop up, not both.

How would I switch to a refresh then?

Change the middle part to this


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

amazing. Thanks.

  • Author
  • Registered
  • August 10, 2017
Anyone know if there are any more "jGrowl-COLORS" available?
I seem to get a yellowish one with no formatting if using any other color name other than jGrowl-green?