Page 1 of 1

Copy/Paste Buttons - Paste Error

Posted: Fri Sep 03, 2021 12:08 am
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.

---------------

Re: Copy/Paste Buttons - Paste Error

Posted: Fri Sep 03, 2021 7:44 am
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'));

Re: Copy/Paste Buttons - Paste Error

Posted: Fri Sep 03, 2021 5:53 pm
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
--------

Re: Copy/Paste Buttons - Paste Error

Posted: Fri Sep 03, 2021 8:54 pm
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.

Re: Copy/Paste Buttons - Paste Error

Posted: Fri Sep 03, 2021 11:43 pm
by skyline101
Hi Kevin

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

Thank you for your help,

Re: Copy/Paste Buttons - Paste Error

Posted: Tue Sep 07, 2021 7:47 pm
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.

Re: Copy/Paste Buttons - Paste Error

Posted: Mon Sep 13, 2021 8:28 am
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.

Re: Copy/Paste Buttons - Paste Error

Posted: Mon Sep 13, 2021 3:29 pm
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

Re: Copy/Paste Buttons - Paste Error

Posted: Wed Sep 15, 2021 12:49 am
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.