Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Copy/Paste Buttons - Paste Error

Questions related to using nuBuilder Forte.
Post Reply
skyline101
Posts: 27
Joined: Wed Jul 21, 2021 11:26 pm
Been thanked: 1 time

Copy/Paste Buttons - Paste Error

Unread post by skyline101 »

Hi

I have set up Copy and Paste buttons on a Browse and Edit form. From my graphic below, I would like to Copy the contents from one or many fields (left side) and Paste them onto similar fields (right side) with different id's.. I also would like to do the same with some fields from a subform.

COPY
I used the following code to Copy only two fields, however, it only works with one field.

Code: Select all

nuCopyText('Tenteredby','Tentereddate');
PASTE
I used the following code to Paste the above two fields, however the various browsers I have tried, it does not work and they all throw the error marked on the graphic below. I tested it out with only one field but I get the same result.

Code: Select all

nuPasteText('enteredby','tentereddate');


I also tried nuGetValue() and nuSetValue() but did not manage to get it to work. Thank you in advance for any help you can provide.

---------------
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Copy/Paste Buttons - Paste Error

Unread post by kev1n »

I do not recommend using the clipboard for this purpose. Use nuGetValue(), nuSetValue():

Make sure that the Ids are correct (case sensitive):

Code: Select all

nuSetValue('enteredby', nuGetValue('Tenteredby'));
skyline101
Posts: 27
Joined: Wed Jul 21, 2021 11:26 pm
Been thanked: 1 time

Re: Copy/Paste Buttons - Paste Error

Unread post by skyline101 »

Hi Kevin

That code works perfectly. One more question, how do I copy/paste the fields of a subform, that I have on the left side of the form, onto to the right (same) subform having different field id's, updating the same customer id?

Yes, I always use lower caps for id's, on my post I typed it incorrectly. Thanks
--------
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Copy/Paste Buttons - Paste Error

Unread post by kev1n »

You will need JavaScript knowledge to be able to achieve that. nuSubformObject() returns a JavaScript object that can be looped through. Then use nuSetValue() to set a cell's value.
skyline101
Posts: 27
Joined: Wed Jul 21, 2021 11:26 pm
Been thanked: 1 time

Re: Copy/Paste Buttons - Paste Error

Unread post by skyline101 »

Hi Kevin

I will look into it to see if I can get it to work.

Thank you for your help,
skyline101
Posts: 27
Joined: Wed Jul 21, 2021 11:26 pm
Been thanked: 1 time

Re: Copy/Paste Buttons - Paste Error

Unread post by skyline101 »

Hi Kevin

To solve the copy of data from a subform to the clipboard problem, I applied the snippet code from 4.0 library https://github.com/smalos/nuBuilder4-Co ... _clipboard because version 4.5 https://github.com/nuBuilder/nuBuilder- ... _clipboarddoes not work as it missing a big chunk of custom code.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Copy/Paste Buttons - Paste Error

Unread post by kev1n »

skyline101 wrote:does not work as it missing a big chunk of custom code.
nuSubformToClipboard() and the related functions have been included in nuBuilder's core libraries. If you don't find them in nuform.js, update nuBuilder to the latest version.
skyline101
Posts: 27
Joined: Wed Jul 21, 2021 11:26 pm
Been thanked: 1 time

Re: Copy/Paste Buttons - Paste Error

Unread post by skyline101 »

Hi Kevin

I am running on:

DB Version: V.4.5-2021.08.05.01
Files Version: V.4.5-2021.08.06.01

I checked nuform.js code and yes all subfomtoCliboard() related functions are there. Not sure why it only worked after I added the 4.0 code.

Thanks
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Copy/Paste Buttons - Paste Error

Unread post by kev1n »

That's quite strange.

When I run

Code: Select all

nuSubformToClipboard('accform', '\t');
in the Access Levels form, the subform data is copied to the Clipboard.
You do not have the required permissions to view the files attached to this post.
Post Reply