Hello, I want to save in the database who copied on the clipboard input text but I have already added code that makes the “Copy” button functional and I don’t want to add another submission button. I want to save this submission in 2 databases that I added to the page. Please HELP
I added this:
import wixWindow from ‘wix-window’ ;
$w . onReady (() => {
$w ( “#CopyToTheClipboard” ). onClick (() => {
**let** textMessage = $w ( "#input1" ). value ;
wixWindow . copyToClipboard ( textMessage )
. then (() => {
$w ( "#CopyToTheClipboard" ). disable ();
$w ( "#CopyToTheClipboard" ). label = 'Copied!' ;
returnToDefault ();
})
})
});
//Add a function to enable button and change the label after 1 second
function returnToDefault ( ) {
if ( $w ( “#CopyToTheClipboard” ). disable ()) {
setTimeout ( function () {
$w ( “#CopyToTheClipboard” ). enable ();
$w ( “#CopyToTheClipboard” ). label = ‘Copy Text’ ;
}, 1000 )
}
}
let clicked = false ;
$w . onReady (
function (){
$w ( ‘#contentCopied’ ). label = ‘ReferralCodeOwner’ ;
$w ( “#dataset1” ). save ()
$w ( “#dataset2” ). save ()
. then (( item ) =>{
console . log ( “data was saved.” );
})
. catch (( err ) => {
let errMsg = err ;
});