Copy/Paste Buttons - Paste Error

Questions related to using nuBuilder Forte.

Copy/Paste Buttons - Paste Error

Unread postby skyline101 » Fri Sep 03, 2021 7:38 am

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.

---------------
Attachments
Paste-Error.png
Paste Error
Paste-Error.png (77.18 KiB) Viewed 214 times
skyline101
 
Posts: 27
Joined: Thu Jul 22, 2021 6:56 am
nuBuilder Version: 4.5

Re: Copy/Paste Buttons - Paste Error

Unread postby kev1n » Fri Sep 03, 2021 3:14 pm

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'));
kev1n
nuBuilder Team
 
Posts: 2008
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Copy/Paste Buttons - Paste Error

Unread postby skyline101 » Sat Sep 04, 2021 1:23 am

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
--------
skyline101
 
Posts: 27
Joined: Thu Jul 22, 2021 6:56 am
nuBuilder Version: 4.5

Re: Copy/Paste Buttons - Paste Error

Unread postby kev1n » Sat Sep 04, 2021 4:24 am

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.
kev1n
nuBuilder Team
 
Posts: 2008
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Copy/Paste Buttons - Paste Error

Unread postby skyline101 » Sat Sep 04, 2021 7:13 am

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: Thu Jul 22, 2021 6:56 am
nuBuilder Version: 4.5

Re: Copy/Paste Buttons - Paste Error

Unread postby skyline101 » Wed Sep 08, 2021 3:17 am

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-Code-Library/tree/master/codelib/subform_copy_to_clipboard because version 4.5 https://github.com/nuBuilder/nuBuilder-4.5-Code-Library/tree/master/codelib/subform_copy_to_clipboarddoes not work as it missing a big chunk of custom code.
skyline101
 
Posts: 27
Joined: Thu Jul 22, 2021 6:56 am
nuBuilder Version: 4.5

Re: Copy/Paste Buttons - Paste Error

Unread postby kev1n » Mon Sep 13, 2021 3:58 pm

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.
kev1n
nuBuilder Team
 
Posts: 2008
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Copy/Paste Buttons - Paste Error

Unread postby skyline101 » Mon Sep 13, 2021 10:59 pm

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
skyline101
 
Posts: 27
Joined: Thu Jul 22, 2021 6:56 am
nuBuilder Version: 4.5

Re: Copy/Paste Buttons - Paste Error

Unread postby kev1n » Wed Sep 15, 2021 8:19 am

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.
Attachments
2021-09-15_004340.jpg
2021-09-15_004340.jpg (88.98 KiB) Viewed 66 times
kev1n
nuBuilder Team
 
Posts: 2008
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5


Return to General

Who is online

Users browsing this forum: No registered users and 21 guests