Page 1 of 1

Clone Event - change field access

Posted: Wed Jan 17, 2018 12:01 pm
by toms
Hi,

How do I detect a clone action? What I'd like to do is to change the Access of an object from Readonly to Editable after the record has been cloned.
E.g. a field "employee number" is normally readonly and not changeable unless the record is cloned.

Re: Clone Event - change field access

Posted: Wed Jan 17, 2018 4:16 pm
by admin
toms,

I have now added nuIsClone(). http://wiki.nubuilder.net/nubuilderfort ... #nuIsClone

Steven

Re: Clone Event - change field access

Posted: Wed Jan 17, 2018 4:50 pm
by toms
Thanks, now I can change the visibility with this piece of code:

Code: Select all

if (nuIsClone()) {nuEnable('myfield');} else {nuDisable('myfield');};
Now I just need to figure out how to trigger it. As soon as the "Clone'-button is clicked, the code should be executed.


Edit: I attached another click handler to the clone button:

Code: Select all

$("#nuCloneButton").click(function() {
    if (nuIsClone()) {nuEnable('myfield');} else {nuDisable('myfield');};
});
On second thought I wouldn't need the nuIsClone() with this solution. Or is there a better way to do it?

Re: Clone Event - change field access

Posted: Wed Jan 17, 2018 5:24 pm
by admin
toms,

That is now done in Github.

http://wiki.nubuilder.net/nubuilderfort ... #nuOnClone

nuIsClone() will still be useful.

Steven

Re: Clone Event - change field access

Posted: Wed Jan 17, 2018 5:35 pm
by toms
Thank you, that's exactly what I need.

Re: Clone Event - change field access

Posted: Wed Jan 17, 2018 5:39 pm
by admin
.