[Copy To Clipboard Traditional Web] Demo is not working
Question
copy-to-clipboard-traditional-web
Web icon
Forge component by OutGirls Lab .

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

mvp_badge
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

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.

mvp_badge
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

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.