Forum Discussion
_anomDiebolt_
10 years agoQrew Elite
When you click on a button in the Button Bar of your dashboard the URL associated with the button will load and take you away from the dashboard. So there isn't a native way to run script from these buttons and stay on the dashboard page. Well that is easy to fix. First here is a demo with two Alert buttons which run corresponding scripts without reloading or navigating away from the dashboard:
No Tables Just Script
https://haversineconsulting.quickbase.com/db/bj44c8h29
alert1.js
https://haversineconsulting.quickbase.com/db/bj44c8h29?a=dbpage&pagename=alert1.js
alert2.js
https://haversineconsulting.quickbase.com/db/bj44c8h29?a=dbpage&pagename=alert2.js
Here is how you set it up:
(1) save your scripts as user defined pages with a .js extension - for example you might have a script named ProcessRecords.js.
(2) in the button bar of the dashboard create buttons for each script and select the URL to your user defined page. If you did nothing more clicking on one of these buttons would display the contents of the JavaScript file as text. But we will do something more in the following steps that will modify the behavior of the buttons to load the script and unload the dashboard page.
(3) Save the following file as a user defined page in include it as a web page widget on your dashboard.
MyIframe.html
https://haversineconsulting.quickbase.com/db/bj44c8h29?a=dbpage&pagename=MyIframe.html
(4) Edit the file MyIframe.html source to specify the names of the script file and the label you would like to display on your buttons (don't make any other changges)
var buttons = [
{script: "alert1.js", label: "Alert 1"},
{script: "alert2.js", label: "Alert 2"}
];
(5) Well that is all you have to do. When the MyIframe.html file loads on the dashbaord, it will make modifications to the buttons in the Button Bar and hide the display of the iframe so there is no evidence of the crime.
Now you can run all your administrative scripts from your application dashboard off of the Button Bar.
Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=425
No Tables Just Script
https://haversineconsulting.quickbase.com/db/bj44c8h29
alert1.js
https://haversineconsulting.quickbase.com/db/bj44c8h29?a=dbpage&pagename=alert1.js
alert2.js
https://haversineconsulting.quickbase.com/db/bj44c8h29?a=dbpage&pagename=alert2.js
Here is how you set it up:
(1) save your scripts as user defined pages with a .js extension - for example you might have a script named ProcessRecords.js.
(2) in the button bar of the dashboard create buttons for each script and select the URL to your user defined page. If you did nothing more clicking on one of these buttons would display the contents of the JavaScript file as text. But we will do something more in the following steps that will modify the behavior of the buttons to load the script and unload the dashboard page.
(3) Save the following file as a user defined page in include it as a web page widget on your dashboard.
MyIframe.html
https://haversineconsulting.quickbase.com/db/bj44c8h29?a=dbpage&pagename=MyIframe.html
(4) Edit the file MyIframe.html source to specify the names of the script file and the label you would like to display on your buttons (don't make any other changges)
var buttons = [
{script: "alert1.js", label: "Alert 1"},
{script: "alert2.js", label: "Alert 2"}
];
(5) Well that is all you have to do. When the MyIframe.html file loads on the dashbaord, it will make modifications to the buttons in the Button Bar and hide the display of the iframe so there is no evidence of the crime.
Now you can run all your administrative scripts from your application dashboard off of the Button Bar.
Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=425