Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

function nuOnClone

Post Reply
Tinka
Posts: 73
Joined: Mon Feb 24, 2014 2:58 pm

function nuOnClone

Unread post 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
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: function nuOnClone

Unread post 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
Tinka
Posts: 73
Joined: Mon Feb 24, 2014 2:58 pm

Re: function nuOnClone

Unread post 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
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: function nuOnClone

Unread post 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
Post Reply