Jump to content

Recommended Posts

Hi!

There is a Tabular report with a comment field (Text64000). 

I want to add a "Copy Text" button, that on click will copy text from the comment field to the Clipboard, so a customer can copy the text without highlighting and copying.

Just one click action to copy.

 

I have found some solution, but it does not look like working in the reports:  https://www.w3schools.com/howto/howto_js_copy_clipboard.asp

Has anybody done it before or maybe you have some working solution?

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Code for Copy to clipboard 

  • In order to work this code you should replace [@field:ID#] with your unigue ID column field.
  • Field [@field:Sub_Cat] replace with desired filed to copy.
  • Place this code in HTML block of every row of the tabular report Data Page.
<input id="in[@field:ID#]" style="width:1px; opacity:0;" >
<button id="bt[@field:ID#]" type="button">Copy to Clipboard</button>
<script type="text/javascript">
  document.getElementById('bt[@field:ID#]').addEventListener("click", function(){
  document.getElementById('in[@field:ID#]').value="[@field:Sub_Cat]";
  document.getElementById('in[@field:ID#]').select();
  document.execCommand("copy");
});
</script>

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...