cooper collier 11/8/2024 1:56:07 PM this untested code should work, you need to put the javascript into a DBscript file in resources then you can call it from the button. You can easily change how the button looks, make it a small copy icon.
<div style="background-color:yellow; color:navy;"> <p><%=[your column name]%></p> <button onclick="copyToClipboard('<%=[your column name]%>')" style="margin-top: 10px; background-color: navy; color: white; padding: 10px 20px; border: none; cursor: pointer;">Copy to clipboard</button> </div>
<script type="text/javascript"> function copyToClipboard(text) { // You can implement your copy to clipboard function here // as it requires JavaScript. The code to copy text to the clipboard // varies depending on the browser and environment. // Here's a simple example using document.execCommand('copy'):
const copyText = document.createElement('textarea'); copyText.style.position = 'absolute'; copyText.style.left = '-9999px'; copyText.style.top = '0'; copyText.value = text; document.body.appendChild(copyText); copyText.select(); document.execCommand('copy'); document.body.removeChild(copyText); } </script>
|