Forum Discussion
JordanMcAlister
7 years agoQrew Captain
Well, here is link to a button I am trying to replicate, and the demo works, but I'm trying to retrofit it to work for my case of just copying one field instead of multiple.
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=654&_ga=2.213316500.1672376286.1559564048-1030199511.1545336323
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=654&_ga=2.213316500.1672376286.1559564048-1030199511.1545336323
- AlexCertificati7 years agoQrew CadetOh, I should have known he'd have shared that code. I got almost all the way to an actual answer, ha.
So the hard part is done and you just need to meddle with the content of the API query and its outputs? - JordanMcAlister7 years agoQrew Captainyes!
- JordanMcAlister7 years agoQrew Captainwant me to post my code to see if you can see an error?
- AlexCertificati7 years agoQrew CadetSure! Is it not working?
And I guess I can take it you're not here in Miami at Empower? - JordanMcAlister7 years agoQrew Captain(function() {
var dbid = "bmwnna5n4";
var dbidTable1 = "bmwnwyvin";
var apptoken = "dx3ta9k8ehe8acqra66ic6unwyr";
$.ajaxSetup({data: {apptoken: apptoken}});
var querystring = document.location.search;
if (/a=dr/i.test(querystring)) {
$("img[qbu=module]").closest("td").css("background-color", "#FFFFFF");
var audio = new Audio("http://dl.dropboxusercontent.com/s/7ubb14hilzkgnfk/slipkid.mp3");
$("#QBU_Clipboard").on("click", event => {
audio.play();
var rid = QBU_Clipboard.dataset.rid;
$.get(dbidTable1, {
act: "API_DoQuery",
query: '{3.EX.${rid}}',
clist: "165"
}).then(function(xml) {
var mytext = $("STB:Sketch Text", xml).text();
navigator.clipboard.writeText(mytext)
.then(() => {
$.jGrowl("I Got My Clipboard!", {life: 5000, theme: 'jGrowl-green'});
});
});
});
}
})(); - JordanMcAlister7 years agoQrew CaptainCorrect, I am not at Empower
- JordanMcAlister7 years agoQrew CaptainI'll end up deleting the mp3 and changing the growl message but just trying to get it working first
- AustinK7 years agoQrew CommanderMy whole reply got deleted while typing, wonderful.
Is your field name currently "STB:Sketch Text"? Have you tried a name without a colon in it? IS that even text, or is it some kind of "fancy" text? Weird question I know but it doesn't look to be just simple text from a quick Google search.
Does the copy button on your form have a type/value of this? data-rid="1"
The one on Dans site does and that is used in the DoQuery call.
Where exactly is your error? Or even a ballpark of where it fails, does the DoQuery return an xml at all? - AustinK7 years agoQrew CommanderMy whole reply got deleted while typing, wonderful.
Is your field name currently "STB:Sketch Text"? Have you tried a name without a colon in it? IS that even text, or is it some kind of "fancy" text? Weird question I know but it doesn't look to be just simple text from a quick Google search.
Does the copy button on your form have a type/value of this? data-rid="1"
The one on Dans site does and that is used in the DoQuery call.
Where exactly is your error? Or even a ballpark of where it fails, does the DoQuery return an xml at all? - JordanMcAlister7 years agoQrew CaptainGood questions!
Just tried a non-colon name, but to no avail; also, yes, the text I am trying to copy is a special text. It looks like this:
All of the text is also dependent on other things, so it has fields in the formula rich text too. Here is, for instance, the first couple lines:
//START HIGHLIGHT SECTION
"<p style='font-family: Tahoma, Verdana, Segoe, sans-serif;line-height:0'><span style='font-size:85%; font-weight:bold; background-color: #FFFF00'>" & "LAT/LONG: " & [Pole Location: Street 1] & "</span></p>"&
//END HIGHLIGHT SECTION
//START BASIC INFO SECTION
"<p style='font-family: Tahoma, Verdana, Segoe, sans-serif;line-height:0;padding-left:30px'><span style='font-size:85%; font-weight:bold'>Point " & [STB:Point#] & "</span></p>"&
"<p style='font-family: Tahoma, Verdana, Segoe, sans-serif;line-height:0;padding-left:30px'><span style='font-size:85%; font-weight:bold'>Tag# " & [Tag #] & " </span></p>"&
"<p style='font-family: Tahoma, Verdana, Segoe, sans-serif;line-height:.1;padding-left:30px'><span style='font-size:85%; font-weight:bold'>Location# " & [Location #] & "</span></p>"&
//END BASIC INFO SECTION
I would be fine with just manual highlighting the text and pasting, but doing that doesn't copy the text color, background, or line spacing I need.
The text field is a formula rich text and has a fid of 165
The table the text field and copy button are located in had dbid of bmwnwyvin.
Here is the code for my copy button:
[iol] & "copybutton.js" & [/iol]
&
"<a id='QBU_Clipboard' class='Vibrant Success' " &
" data-rid='" & [Pole ID#] & "'" &
">Copy To Clipboard</a>"
Everything works except for the copying. The music plays and the "I Got My Clipboard" popup box shows and nothing else happens. Are you saying the error is in the copy button code? What should I change, if so?