nuBeforeClone in nuBuilderPro v3.0?

Re: nuBeforeClone in nuBuilderPro v3.0?

Unread postby jkdev » Fri Sep 12, 2014 7:45 pm

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
jkdev
 
Posts: 20
Joined: Fri Aug 01, 2014 9:56 pm

Re: nuBeforeClone in nuBuilderPro v3.0?

Unread postby admin » Mon Feb 16, 2015 9:11 am

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();
    }
   
}
admin
Site Admin
 
Posts: 3406
Joined: Mon Jun 15, 2009 9:53 am
nuBuilder Version: 4.5

Previous

Return to Custom Code

Who is online

Users browsing this forum: No registered users and 2 guests