Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

nuBeforeClone in nuBuilderPro v3.0?

jkdev
Posts: 20
Joined: Fri Aug 01, 2014 2:26 pm

Re: nuBeforeClone in nuBuilderPro v3.0?

Unread post 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
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: nuBeforeClone in nuBuilderPro v3.0?

Unread post 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();
    }
    
}
Post Reply