0

I'm not sure if it's possible or not but can you run a script in Quickbase? Such as in a formula field? If so, could someone show me a very simple example? I've figured out how to create custom Dashboards using jQuery so I assume we could do something similar on form/table.

  • Nathan mentioned Dan Diebolt's image onload technique in his answer but didn't have the link to his step by step guide to implementing it. The link: https://community.quickbase.com/quickbase/topics/how-do-i-setup-the-image-onload-technique-iol Happy coding! – Steve McLain Apr 14 '17 at 17:44

1 Answers1

1

There are two ways you could try to accomplish this. You can use Javascript in URL and Formula URL fields. This will make the link button pop up a window that says "Hello World".

"javascript:alert(\"Hello World\");void(0);"

You can also load a page that you've created using Dan Diebolt's image onload technique. I can't find his original post, but you use the onload event of an image tag to load a .js file. In this example it's a page in the same application named module.js that is being loaded using a Formula Text field with HTML enabled.

"<img qbu=\"module\" src=\"/i/clear2x2.gif\" onload=\"javascript:if(typeof QBU=='undefined'){QBU={};$.getScript('" & URLRoot() & "db/" & Dbid() &  ?a=dbpage&pagename=module.js&rand='+Math.random())}\">"

The corresponding module.js file might look something like this:

(function(){
   alert("Hello World");
})(); 

You can take this as far as you'd like from writing functions in module.js that you call from Formula URL Fields to injecting your own HTML into the DOM (though Quickbase recommends you do not do that). My favorite trick is to add <span id="somethingUnique"></span> either in the form builder or a text field with HTML enabled and use that to inject my custom buttons or data.

Nathan Hawe
  • 281
  • 3
  • 5