Hey guys! I hope everyone is okay!
Well, I need to create a button to copy the message that is already inside a field, but this button has to be in the view, not in the detail view.
I managed to create inside the detail view as follows:
<button class = "copy"> COPY ABOVE TEXT </button> <BR> <BR>
<script>
var copyTextareaBtn = document.querySelector ('. copy');
copyTextareaBtn.addEventListener ('click', function (event) {
var copyTextarea = document.querySelector ('. textarea');
copyTextarea.select ();
try {
var successful = document.execCommand ('copy');
var msg = successful? 'yea!' : 'no!';
alert ('THE ABOVE TEXT HAS BEEN COPIED!');
// alert ('Text copied?' + msg);
} catch (err) {
alert ('Oops, we were unable to copy the text, it is possible that your browser is not supported, try using Crtl + C.');
}
});
</script>
Any suggestions on how to do this directly in the table without having to enter the detail view?
Hugs!
Copy button in view - is there how to do it?
Re: Copy button in view - is there how to do it?
Hi,
maybe I did not get completely your requirement, but you want to copy in the TV from one field to another one via a button?
How would you know for which row you want to copy.
Also in the TV usually you do not have something like a "Save" action.
In your sample you copy the field, but it is not yet saved to the database, so if the user quits the page without saving, your copied field is not filled.
How shall this be handled in the TV?
maybe I did not get completely your requirement, but you want to copy in the TV from one field to another one via a button?
How would you know for which row you want to copy.
Also in the TV usually you do not have something like a "Save" action.
In your sample you copy the field, but it is not yet saved to the database, so if the user quits the page without saving, your copied field is not filled.
How shall this be handled in the TV?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.