575
Views
5
Comments
copy data to clipboard
Question
Hi, I need make a button or a link, that copy data from showrecord or expresion to clipboard.
Can I do it from service studio, or I have to make a javascript.

bye bye


2018-05-03 15-19-41
Miguel João
Staff

Hi Eduardo

Unfortunately, Service Studio doesn't have any built-in function/widget that would allow to copy content to the client clipboard. So you'll need to include some javascript on the screen where you want to do that.

I suggest using the Extended properties of the button or link, and set the "onclick" to perform the data copy to the clipboard.

Cheers

Miguel João
2011-06-15 10-49-56
AcacioPN
Staff
Hi Eduardo

Remember that not all browsers and not all security settings will allow javascript to access the clipboard, so make sure to provide an alternative to that functionality that does not assume access to the clipboard. It is the best way to prevent angry users when, for some reason, automatic clipboard placement fails!

Cheers,

APN
UserImage.jpg
Eduardo Albarado

Hi

Thanks for the tips, in an image I use onclick extended properties, then use  this script.

"window.clipboardData.setData('Text',""" +GetContact.List.Current.CONTACT.Email + """)"

Its work in IE, no FireFox.

I hope you understand me, or see this link  https://www.outsystems.com/help/servicestudio/5.0/web_user_interface/adding_java_script.htm

Regards

2024-12-17 14-32-59
Matthias Preuter
 
MVP
I've used this cross platform-sollution, but it depends on flash.

Attach the swf, and use this javascript (onclick):

function copyIntoClipboard(text) {
        var flashId = 'flashId-HKxmj5';

        /* Replace this with your clipboard.swf location */
        var clipboardSWF = 'clipboard.swf';

        if(!document.getElementById(flashId)) {
            var div = document.createElement('div');
            div.id = flashId;
            document.body.appendChild(div);
        }
        document.getElementById(flashId).innerHTML = '';
        var content = '<embed src=""' + clipboardSWF +
            '"" FlashVars=""clipboard=' + encodeURIComponent(text) +
        '"" width=""0"" height=""0"" type=""application/x-shockwave-flash""></embed>';
       document.getElementById(flashId).innerHTML = content;

       window.clipboardData.setData('Text',text);
}

Kind regards,

Matthias Preuter
UserImage.jpg
Manish Barapatre

We are facing copy to clipboard in embeded apps, 
This resolved using the javascript code in Stack overflow

Stack overflow link follow here

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.