Copy to clipboard?

How would I create an interface (button, etc.) that can put something in the user’s clipboard?

Is there a way to add javascript to the UI frontend? This would be trivial in js.

Thanks,
Tim

Hello @Tim_Jones,

you can use the Custom Code block for this purpose - it allows to write any custom logic using JS:

In the example above I’ve used this library:

Regards,
Stanislaw

Thanks @stanislaw.grin! I figured there was a way to do it.

For installation did you just reference the script from wzrd.in? I assume we can’t install libraries in backendless.

Tim

The example above does reference a script directly from wzrd.in, however, it is also possible to install the libraries locally. Unfortunately, I do not know exactly what directory they should be deployed into, I just know it is possible.

I meant to reply. I saw that it does reference the external link when I looked again from my computer. I missed that detail on my phone.

I’m having trouble adding the “text” input argument. It worked once but now when I type in the input field it doesn’t save anything.

Tim

Could you please record a video showing what you’re doing with loom and post the link for the recording here?

Thanks @mark-piller.

Tim

Hi @Tim_Jones,

just press a Tab after typing text.

Regards,
Stanislaw

:man_facepalming:

@stanislaw.grin Thanks. That was simple.

@stanislaw.grin Did you get your example to work? I have the UI builder working, or at least I can get the custom code to create an alert. The actual copy/paste doesn’t work, I think wzrd.in is down or has problems but I’m looking for external confirmation.

Tim

Indeed, seems like there is some issue with their CDN resource.
Ok, I’ve found another working library, try it out:

await BackendlessUI.requireModule('https://cdn.jsdelivr.net/npm/text-copy/index.min.js');

CopyText(text);

Regards,
Stanislaw

1 Like

Thank you! I was going crazy trying to figure out what I was doing wrong.

That works, thanks for the amazing service.

Tim