This topic is locked

How can I make a button copy a field value to the clipboard?

9/12/2016 12:29:18 PM
PHPRunner Tips and Tricks
admin

Q: I want to create a button that will copy the data entered in to the field named "FirstName" before the record is added or inserted.
A: Yes, this can be done. Insert a button using 'Insert button' function in Visual Editor and put the following code to Client Before event:

$("#value_FirstName_1").select();

document.execCommand("copy");

$("#value_FirstName_1").blur();
L
leesayer 3/16/2017



Q: I want to create a button that will copy the data entered in to the field named "FirstName" before the record is added or inserted.
A: Yes, this can be done. Insert a button using 'Insert button' function in Visual Editor and put the following code to Client Before event:

$("#value_FirstName_1").select();

document.execCommand("copy");

$("#value_FirstName_1").blur();



Hi.. I have tried the above, but cannot seem to get the "copy to clipboard" working. I have added a button to my "View" page (PHPrunner 9.7). I would like to add the contents of a field (called 'chassis') to the clipboard on click of the button (so that this can be right click pasted to another input box on the same page by a client).

I have put the following code in the Client Before event:
$("#value_chassis_1").select();

document.execCommand("copy");

$("#value_chassis_1").blur();
Any thoughts on what I may be missing here?

admin 3/20/2017

It will only work on Add or Edit pages. Only designed to work with input boxes.