Copy to Clipboard Event

At George’s request, this is a request to add some kind of copy to clipboard dynamic event to Wappler.

What would be a use case for this?

Like when you copy a link to a Google map pin and paste it into an email…

1 Like

I did a clipboard-type feature using local storage. I created a CRM where one part showed all the customer details. I wanted to store a customer ID in the virtual clipboard so an invoice could be created on another screen without the need to remember or search again. Local storage worked perfectly for this. I showed a ‘View clipboard’ button when there was something stored and deleted it after pasting.

But @sitestreet, did the user need to select-all and edit-copy the text you presented, or could they just click a [Copy] button to copy it to the clipboard?

It is the latter I am looking for…

I gave them a button which literally said ‘Copy to clipboard’. They didn’t see the ID that was copied, they were unaware of the behind-the-scenes saving of it to the local storage, they just got a notification saying it had ‘Copied to clipboard’. The value remains in the local storage so at any time they could go to the other page where they saw a button labelled ‘Paste from clipboard’. It then gets the value from the local storage and then (optionally) deletes the local storage. Works perfectly and just as you’d expect it to.

Sounds good!

However…

It sounds like it wasn’t really in the clipboard - is that correct?

I need them to have it actually in the clipboard to paste into another application such as an email…

Aah, I see what you mean. No, it’s not in the actual computer clipboard. Sorry, I think I misunderstood your original post.

It must be some simple javascript to do that, though. Loads of sites use that technique. So I guess that’s the point of your post - you want Wappler to have that feature built in. I shall vote for it :wink:

https://www.w3schools.com/howto/howto_js_copy_clipboard.asp

1 Like

Yesterday’s release make it easy to put plain javascript into a flow so maybe that’s the way to achieve what you want?

Well yes, that is possible… which brings the conversation full circle.

I said that on the post about JS from flows, and George said “we can put that into Wappler, so create a feature request.”

So here it is.

Sparking lots of debate! :slight_smile:

1 Like

Apologies for taking you full circle. I’ve voted for it but maybe my explanation of a virtual clipboard using local storage will be helpful to someone.

No worries Jon!

1 Like

Thanks for the link @sitestreet . It worked great!

1 Like

Maybe we should add this to the browser component @patrick

4 Likes

Up, would be great to have it in the Browser component, even in 2021 :smiley:

Thanks @patrick! :tada:

Nice!! Thanks @patrick :smiley:

1 Like

This has been added to Wappler 4.1.0

4 Likes