copy data to clipboard

copy data to clipboard

  
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



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
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

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  http://www.outsystems.com/help/servicestudio/5.0/web_user_interface/adding_java_script.htm

Regards

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