function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dikudiku 

need to have copy to clipboard functionality

Ashish_SFDCAshish_SFDC
HI , 

Here is an example Visualforce page that incorporates javascript to copy specified text to the Windows clipboard.I'm posting it in case anyone else wants to do this again.

NOTE: This only works on Internet Explorer. it makes use of IE-only javascript extensions. To do the same thing in a standards-based browser is more complicated, and will require some other technology, like Flash.

Basic example:


view sourceprint?

<apex:page title="Clipboard Test" >
<apex:messages />
    <script language="JavaScript">
         function ClipBoard(copytextid, holdtextid)
 
        {
 
            holdtxt = document.getElementById(holdtextid);
 
            holdtxt.innerText = document.getElementById(copytextid).innerText;
 
            Copied = holdtxt.createTextRange();
 
            alert("text in buffer \"" + holdtxt.innerText + "\"");
 
            Copied.execCommand("Copy");
 
        }
 
    </script>
    
 
    <apex:pageblock >
 
    <apex:form >
        <apex:outputpanel ID="copytext" STYLE="height:150;width:162;background-color:pink">
            Text to Copy
        </apex:outputpanel>
        
                <apex:inputtextarea ID="holdtext" STYLE="display:none;">
        </apex:inputtextarea>

        <apex:commandbutton onClick="ClipBoard('{!$Component.copytext}', '{!$Component.holdtext}')" value="Copy to Clipboard"/>
    </apex:form>

    </apex:pageblock>

</apex:page>

https://developer.salesforce.com/forums/ForumsMain?id=906F000000096UHIAY


Or 

The closest thing you'll get for this is to either export to XLS or CSV format using a report or use the printable view option in the top right hand corner of the record.
Other then these options there is not much else to go on without having a developer build something using Apex & Visual Force.

https://success.salesforce.com/answers?id=90630000000h10ZAAQ


Add a "Copy Address to Clipboard" Button to Your Contact Form
- See more at: http://blogs.c5insight.com/Home/tabid/40/entryid/50/Add-a-Copy-Address-to-Clipboard-Button-to-Your-Contact-Form.aspx#sthash.Rxsgw61F.dpuf

http://blogs.c5insight.com/Home/tabid/40/entryid/50/Add-a-Copy-Address-to-Clipboard-Button-to-Your-Contact-Form.aspx


Regards,
Ashish