Discussions

 View Only
Expand all | Collapse all

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

QuickBaseCoach Dev./Training

QuickBaseCoach Dev./Training04-22-2017 20:10

QuickBaseCoach Dev./Training

QuickBaseCoach Dev./Training05-22-2017 16:11

Stephen Stephen

Stephen Stephen05-22-2017 18:35

Stephen Stephen

Stephen Stephen05-22-2017 19:54

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

    Posted 04-20-2017 18:21
    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. 


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

    Posted 04-20-2017 18:40
    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.


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

    Posted 04-20-2017 20:06
    Just what I needed!! FYI, it works like a charm in reports as well!!

    BIG THANKS!


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

    Posted 04-20-2017 21:07
    Is there a way to implement this from a Formula-Text button, instead of a Formula-URL ??

    Thanks


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

    Posted 04-20-2017 21:36
    It took me a while to get this working as there were some recent posts from Laura Hillier and Matthew Neil which i needed to cobble together. But now i have it for myself too.  There is some crazy syntax for sure.

    This worked

    var text Update= URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & ToText([Record ID#])  & "&_fid_188=" & ToText(Now());

    var text URL = 
    "javascript:" &
    "$.get('" & 
    $Update & 
    "',function(){" &
    "$.jGrowl('This Item has been put on PO CANCEL snooze', {life: 5000, theme: 'jGrowl-green'});" &
    "});" &
    "void(0);";

    "<a class='Vibrant Danger' href=\"" & $URL &"\"" & ">Button name goes here" &  "</a>"




    The choices for the button color are:
    "<a class='Vibrant'>Vibrant</a>", // regular grey button :(
        "<a class='Vibrant Alert'>Vibrant Alert</a>", // yellowish
        "<a class='Vibrant Danger'>Vibrant Danger</a>",  // red
        "<a class='Vibrant Primary'>Vibrant Primary</a>", // blue
        "<a class='Vibrant Snowy'>Vibrant Snowy</a>",  // white
        "<a class='Vibrant Success'>Vibrant Success</a>" // green
    )


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

    Posted 04-21-2017 18:46

    Mark, Carlos

    I cannot get either script to work. I am using a _fid_### of my own choosing, but not getting it populated.

    Here is the formula URL script I'm using:

    var text URL = URLRoot() & "db/" & "?act=API_EditRecord&_fid_158=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);"

    Here is the formula Text script:

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

    & "&_fid_158=" & ToText(Now());

    var text URL =
    "javascript:" &
    "$.get('" &
    $Update &
    "',function(){" &
    "$.jGrowl('This Item has been put on PO CANCEL snooze', {life: 5000, theme: 'jGrowl-green'});" &
    "});" &
    "void(0);";

    "<a class='Vibrant Danger' href=\"" & $URL &"\"" & ">Button name goes here" &  "</a>"

    Any assistance is appreciated.

    Chris




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

    Posted 04-21-2017 18:54
    Do you have application tokens enabled or disabled?  If they are enabled, then try disabling them while you are testing.


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

    Posted 04-21-2017 20:18
    In the URL script it would seem you're missing the DBID() parameter as well.
    App tokens definitely could be part of the issue. 
    What error do you get?


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

    Posted 04-21-2017 20:20
    Right,
    That URL formula should be

    var text URL = URLRoot() & "db/" & dbid() &  "?act=API_EditRecord&_fid_158=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);"



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

    Posted 04-22-2017 00:50

    Most of my apps have application tokens enabled for cross app relationships. I do not get an error message, the test text is just not written.

    When I turn off application tokens, the scripts work, but I have to refresh the screen to see the result. Is that intended?




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

    Posted 04-22-2017 01:04
    In this case yes. That's intended. Theres no redirect in the URL so you need to manually refresh to see the changes


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

    Posted 04-22-2017 02:00
    Chris,
    You need to add the application token to the URL.

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


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

    Posted 04-22-2017 02:02
    But do you want to refresh the Page automatically? If so it's a different JavaScript.


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

    Posted 04-22-2017 02:04
    javascript:" &
    "$.get('" &
    $URL &
    "',function(){" &
    "location.reload(true);" &
    "});"
    & "void(0);


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

    Posted 04-22-2017 02:30
    Very good. Thanks, guys. This is good stuff.


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

    Posted 04-22-2017 18:51

    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



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

    Posted 04-24-2017 14:31
    Chris, no nothing different.

    Here's the code to one of the buttons I did:

    var text action = URLRoot() & "db/" & Dbid() & "?a=API_editRecord&key="& [Item] & "&_fid_699=1" & "&_fid_700=" & URLEncode(User()) & apptoken=abcdefg1234567;
    var text url = "javascript:" & "$.get('" & $action & "',function(){" & "$.jGrowl('Growl notification text goes here', {life: 5000, theme: 'jGrowl-green'});" &"});" &"void(0);";
    var text button  = "<a class='Vibrant Alert' href=\"" & $url &"\"" & "> Do action and Growl " &  "</a>";

    $button


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

    Posted 04-22-2017 20:10
    The buttons should work identically on a report or form.


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

    Posted 04-24-2017 16:02
    Are you aware of any changes to this? after this weekend's update this no longer seems to be working from reports or records


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

    Posted 04-24-2017 16:16
    It's working for me.

    This is working, for example.

    var text Update= URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & ToText([Record ID#])  & "&_fid_188=" & ToText(Now());

    var text URL = 
    "javascript:" &
    "$.get('" & 
    $Update & 
    "',function(){" &
    "$.jGrowl('This Item has been put on PO CANCEL snooze', {life: 5000, theme: 'jGrowl-green'});" &
    "});" &
    "void(0);";

    "<a class='Vibrant Danger' href=\"" & $URL &"\"" & ">Button name goes here" &  "</a>


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

    Posted 05-22-2017 13:19
    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>"


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

    Posted 05-22-2017 14:59
    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


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

    Posted 05-22-2017 15:24
    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.


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

    Posted 05-22-2017 15:51
    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);


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

    Posted 05-22-2017 16:11
    Can you post your current code that is not working?


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

    Posted 05-22-2017 16:23
    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>"


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

    Posted 05-22-2017 17:54
    Do I have to onload anything? Does the jGrowl just work?


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

    Posted 05-22-2017 18:01
    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 '.


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

    Posted 05-22-2017 18:18
    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!


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

    Posted 05-22-2017 18:21
    :) 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.


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

    Posted 05-22-2017 18:28
    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....


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

    Posted 05-22-2017 18:31
    Indeed... Though a "background" refresh would be great, as linked buttons won't reflect changes performed through these jgrowl actions so you always need to refresh before clicking elsewhere


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

    Posted 05-22-2017 18:31
    :)  One per customer.  You get to choose a page refresh or the pop up, not both.


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

    Posted 05-22-2017 18:35
    How would I switch to a refresh then?


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

    Posted 05-22-2017 18:37
    Change the middle part to this


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


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

    Posted 05-22-2017 19:54
    amazing. Thanks.


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

    Posted 08-10-2017 00:09
    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?


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

    Posted 08-16-2019 12:04
    Were you able to figure out a way to get different colors?