80
Views
4
Comments
Solved
[Copy To Clipboard Traditional Web] Demo is not working
Question
copy-to-clipboard-traditional-web
Web icon
Forge asset by beatriz.silva@digitalalchimia.com, daiannecaetanoo@gmail.com

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

2021-03-18 21-03-15
Benjith Sam
 
MVP
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

ClipboardDemoTraditionalWeb.oml
2020-06-22 03-47-23
Ruttanachai Auitragool

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.

2021-03-18 21-03-15
Benjith Sam
 
MVP

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

UserImage.jpg
hongquan ji

dear Benjith Sam

when I run the method [navigator.clipboard.writeText] at my platform , the method [writeText] not defined error message is outputted. 

Could you tell me if which compoent  is not enough at my platform .

hongquan ji

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.