Cloning problem
Hello,
I created a form where I set clonable = no for some fields, but otherwise the values are copied. It worked in Nubuilder 4.5, but I experience this everywhere with newer versions. What is the error?
Thanks!
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Clone problem
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Clone problem
Hi,
To resolve the cloning issue, try replacing the following line in nuform.php:
with
This change passes $cloneableObjects by reference, which may fix the problem in newer versions of nuBuilder.
Give it a try and let me know if it works!
To resolve the cloning issue, try replacing the following line in nuform.php:
Code: Select all
function nuGetFormModifyObject($object, $formObject, $row, $recordId, $data, $numObjects, $cloneableObjects, $dbFields) {
Code: Select all
function nuGetFormModifyObject($object, $formObject, $row, $recordId, $data, $numObjects, &$cloneableObjects, $dbFields) {
Give it a try and let me know if it works!
Re: Clone problem
Hi Kev1n!
Thanks for the quick reply!
Yes, this solved the clone problem!
But I faced another problem.
Some objects are clonable = no and No Duplicates. The first clone works fine, the data disappears from the fields. But when I try this again, when saving a new record, I get a message that the object has a duplicate, even though the field is empty.
Thanks for the quick reply!
Yes, this solved the clone problem!
But I faced another problem.
Some objects are clonable = no and No Duplicates. The first clone works fine, the data disappears from the fields. But when I try this again, when saving a new record, I get a message that the object has a duplicate, even though the field is empty.
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Clone problem
Just to confirm that I understand what you're trying to do:
Some fields are marked as clonable = "no" and set to "No Duplicates".
When you clone the form, those fields are blanked out as expected.
You save the form — everything works fine.
Then, when you clone the form again, the same fields are blanked out again.
However, this time you get a validation error saying something like “objectXYZ has a duplicate.”
I’m assuming this happens because, technically, there’s already an empty value for that field in the database, and the system treats that as a duplicate.
But since the fields are blank, we would expect multiple empty values to be allowed.
Do I have a correct understanding of the issue?
Some fields are marked as clonable = "no" and set to "No Duplicates".
When you clone the form, those fields are blanked out as expected.
You save the form — everything works fine.
Then, when you clone the form again, the same fields are blanked out again.
However, this time you get a validation error saying something like “objectXYZ has a duplicate.”
I’m assuming this happens because, technically, there’s already an empty value for that field in the database, and the system treats that as a duplicate.
But since the fields are blank, we would expect multiple empty values to be allowed.
Do I have a correct understanding of the issue?
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Clone problem
I believe the issue has been resolved — please give it another try.
Replace
Replace
/core/nudata.php
with the attached file:
Test it again and let me know if everything works as expected.You do not have the required permissions to view the files attached to this post.
Re: Clone problem
Works like a charm!!!
Is it possible that these changes will be included in future updates?
Thanks Kev1n!!
Is it possible that these changes will be included in future updates?
Thanks Kev1n!!
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact: