[Copy To Clipboard Traditional Web] Demo is not working

Forge Component
(0)
Published on 12 Apr by OutGirls Lab .
0 votes
Published on 12 Apr by OutGirls Lab .

I tried the demo by click copy then paste into Notepad and found nothing has been copied to the clipboard.

Solution

Hi Ruttanachai Auitragool,

I'm not aware about this component but I do have a solution for your requirment.

See this sample app 

Please find the attached .oml file

JavaScript Code Snippet

"var textToCopy = document.getElementById('" + Input_UserInput.Id +"').value;
navigator.clipboard.writeText(textToCopy)
  .then(() => { alert(`Copied!`) })
  .catch((error) => { alert(`Copy failed! ${error}`) })
"


Hope this helps you!


Regards,

Benjith Sam

Solution

Benjith Sam wrote:

Hi Ruttanachai Auitragool,

I'm not aware about this component but I do have a solution for your requirment.

See this sample app 

Please find the attached .oml file

JavaScript Code Snippet

"var textToCopy = document.getElementById('" + Input_UserInput.Id +"').value;
navigator.clipboard.writeText(textToCopy)
  .then(() => { alert(`Copied!`) })
  .catch((error) => { alert(`Copy failed! ${error}`) })
"


Hope this helps you!


Regards,

Benjith Sam

 

 Thank you Benjith,

Your solution is the best. I'm looking for a pure JavaScript solution to use in the OutSystems project and this is works.

Ruttanachai Auitragool wrote:

Thank you Benjith,

Your solution is the best. I'm looking for a pure JavaScript solution to use in the OutSystems project and this is works.

You are welcome, Ruttanachai :)

I'm happy that it helped you :)


Regards,

Benjith Sam