Page 1 of 1

function nuOnClone

Posted: Tue Jan 20, 2015 2:26 pm
by Tinka
Hi!

I want to clone a record, and reset some of the fields on the Edit form. The function nuOnclone as described in Javascript functions should do that. I activated the Action button Clone. When clicked, the record is cloned, but the fields are not cleared (they are when using nuLoadEdit).

I have this (and more) on the Javascript of the form:

Code: Select all

function nuOnClone(){     
 
   $( '#chrom_location').val('');
   $( "#genpos_strand").val('');
   $( "#genpos_start").val('');
   $( "#genpos_end").val('');
   $( "#prim_name").val('');
   return true; 
 
}
BR, Tinka

Re: function nuOnClone

Posted: Tue Jan 27, 2015 10:54 pm
by admin
Tinka,

You may find it easier to set the Objects new values by setting the Object's Allow Cloning and Default Value properties.

http://wiki.nubuilder.net/index.php/Add ... ow_Cloning

Steven

Re: function nuOnClone

Posted: Wed Jan 28, 2015 1:17 pm
by Tinka
Ok, that would be another way to go about this. Nice suggestion.

But the function nuOnClone does not work (for me)?

BR, Tinka

Re: function nuOnClone

Posted: Wed Jan 28, 2015 11:54 pm
by admin
Tinka,

The use of nuOnClone() was explained incorrectly in the wiki.

I have fixed that now, thanks for pointing it out.

http://wiki.nubuilder.net/index.php/Jav ... lone.28.29

Steven