Page 2 of 2

Re: nuBeforeClone in nuBuilderPro v3.0?

Posted: Fri Sep 12, 2014 12:15 pm
by jkdev
Steven,
nuOnClone() is more or less similar to nuBeforeClone() that I used and it did not help.

By executing nuAfterClone() which gets after the object is created I was able to change the form variable #pr_status.

For the original problem that I had I deviced a temporary solution to display the Save button using a somewhat longer display condition.

But for the application that I am building, I really need the ability to change the hash variables when cloned.
Probably a hook can be embedded in the code where the hash variables are being replaced with values when displaying the form.

Appreciate if you can give me some pointers as to where the hash variables are translated so that I can give it a try.

jk

Re: nuBeforeClone in nuBuilderPro v3.0?

Posted: Mon Feb 16, 2015 12:41 am
by admin
jkdev,

Here is a solution.

Step 1. Create a function that you can put your new values in (Before Open)

Code: Select all

$t = nuRunQuery("SELECT COUNT(*) AS i FROM invoice");
$r = db_fetch_object($t);
$j = "
function changeValues(){
    $('#total_invoice').val($r->i);
}
";

nuAddJavascript($j);
Step 2. Call the function when a record is being cloned (Javascript) Code

Code: Select all


function nuLoadEdit() { 

    if('#cloned#' == 1){
        changeValues();
    }
    
}