You are attempting to jam HTML, JavaScript and CSS into your formulas. You will have less problems and greater flexibility if you keep your formulas as simple as possible and use a JavaScript injection technique. The JavaScript that you inject (say module.js) can add the necessary HTML, CSS dynamically and respond to events (such as click events) using event
handlers.
In this post to the old forum I posted a 10 page pdf document on various way to bind JavaScript to a button and pass field values to the script:
https://community.quickbase.com/quickbase/topics/add-javascript-to-a-buttonUnfortunately the file was dropped when the messages were converted to the new forum. If you want a copy of the document let me know.
Here is a cut and paste from the document of the code you can use:
Button Formula:[iol] & "moduleTable5.js" & [/iol]
&
"<a class='QBU_Button Vibrant Success' " &
" data-rid='" & [Record ID#] & "'" &
" data-name='" & [Name] & "'" &
">Button</a>"
Script Template:(function() {
var dbid = "YOUR APP DBID";
var dbidTable1 = "YOUR TABLE DBID";
var apptoken = "YOUR APP TOKEN";
$.ajaxSetup({data: {apptoken: apptoken}});
$("a.QBU_Button").on("click", function(event) {
console.log("moduleTable5.js");
var rid = this.dataset.rid;
var name = this.dataset.name;
console.log("rid=", rid);
console.log("name=", name);
});
})();