SmartForms - Copy to clipboard?

Anyone have an idea how I could do a rule to copy to the client clipboard?

4 replies

Badge +8

I don't believe this is possible today. But it sounds like an excellent feature request.

I would suggest you submit product feedback for this, at the following link:


Thanks, and regards,


Copy to clipboard would be fun to do.  


I would suspect you'd have to create a service that you could build a smartobject out of.  I might give this one a shot:


Did this ever get resolved?
This would be really useful.

Ok, I managed to get to the bottom of this as follows:


There is a limitation that you can only copy to clipboard when a user is generating an event on a webpage (e.g. double clicking a field) due to browser security restrictions. This is to stop webpages arbitrarily overwriting the clipboard which makes sense.


As long as this is what you want then you can do the following:


1) Change the fields ToolTip text to something unique. For example "Click to copy to clipboard"

2) Add a datalabel to the view and tick "Literal" and un-tick "Prevent XSS"

3) Create a rule with two data transfer actions and make sure you call the rule on "Initialize"

4) The first transfer should blank your data label

5) The second transfer should copy the following to the data label


<script type="text/javascript">$(document).ready(function() { $("[title='Click to copy to clipboard']").dblclick(function() {navigator.clipboard.writeText(this.text);});});</script>


When the user double clicks the field it will copy the text in the field to the clipboard.


This was to suite my requirements to be able to double click a text field in a list view and have it copied to the clipboard. If you want to use it in another way, say for instance when a user clicks a button then change the ".dblclick" to ".click" and add the ToolTip text to the button so it triggers when you press it. You'll also need to work out how to change the "this.text" to the information that you want to copy to the clipboard which might be more tricky but at least it's a strating point.