Copy field data to clipboard
Is there a way to code a button so that when pushed the value of one field from a model is copied to the clipboard?
Tagged:
1
Categories
- 7.9K Questions
- 926 Ideas
- 220 Discussion Categories
- 178 General
- 9 Community Feedback
- 3 Community Info
- 18 Knowledge Base
Comments
Take a look at this tip on copying to the clipboard. It shows how to code some JavaScript to get content from an input field. I think this will get you started.
http://www.jstips.co/en/javascript/copy-to-clipboard/
Thanks,
Bill
Thank you for your response.Below is the code that I have written so far. I don't get any errors but I also don't get the field contents to the clipboard.
Can you see the error of my ways?
I think the select() function only works when the field is in Edit mode. I don't think you will be able to set this up to work when the page loads.
Here is a working sample page.
Thanks,
Bill
A post script to my reply...The reason the select() function works with the field in Edit mode is that the function only supports selecting text from <input> fields.
Here is a link that shows how to copy any string by creating an input element and appending it to your page in a position where it won't show.
https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f
Thanks,
Bill