I need to modify some fields in a form when Clone button is pressed before a fresh forn is displayed.
Tried the nuBeforeClone() functuon in Javascript Tab for Custom Code.
Nothing happened.
I wonder wherther similar command is available in V3.0
function nuLoadEdit(){
console.log('#nu_cloned_record#');
}
RESULT: SUCCESS
0 File(s) updated
No Column(s) Added
No Column(s) Changed
No SQL errors
No Warnings
-rw-r--r-- 1 www-data root 0 2014-08-09 10:35 file-uploads-go-here
drwxr-xr-x 3 www-data www-data 4096 2014-08-23 15:05 GIT_2014_08_23_15
drwxr-xr-x 3 www-data www-data 4096 2014-09-02 07:53 GIT_2014_09_02_07 <=======
drwxr-xr-x 3 www-data www-data 4096 2014-09-02 08:00 GIT_2014_09_02_08 <=======
function nuLoadEdit(){
var cloned = '#nu_cloned_record#';
if (cloned > 0){
$('#field1').val('NEW');
$('#field1').change;
$('#field2').val('TEMP');
}
}
nuSetHash('hashvariable', value);
nuCloneForm(this, formid, nuGetHash('record_id')
nuSetHash('pr_status','NEW');
nuCloneForm(this, '#FORM_ID#', nuGetHash('record_id'));
function nuCloneForm(pThis, formID, recordID) {
// Check if nuBeforeClone() is defined by user
if (typeof nuBeforeClone == 'function' && nuBeforeClone() == false) {
return;
}
var w = new nuWindow();
w.form_id = formID;
w.title = $('title').html();
w.call_type = 'cloneform';
w.cloned = '1';
w.record_id = recordID;
w.tip = 'Edit';
window.nuSession.breadCrumb.pop(); //-- remove breadcrumb before another is added
nuBuildForm(w);
}
/*
* This function must return TRUE to allow or FALSE to stop cloning.
*/
function nuBeforeClone() {
// Make your job
return confirm('Do you want to clone this record?');
}
function nuCloneForm(pThis, formID, recordID){
// Check if nuBeforeClone() is defined by user and it returns TRUE
if (typeof nuBeforeClone == 'function' && nuBeforeClone() == false) {
return;
}
var w = new nuWindow();
w.form_id = formID;
w.title = $('title').html();
w.call_type = 'cloneform';
w.cloned = '1';
w.record_id = recordID;
w.tip = 'Edit';
window.nuSession.breadCrumb.pop(); //-- remove breadcrumb before another is added
nuBuildForm(w);
// Check if nuAfterClone() is defined by user and it returns TRUE
if (typeof nuAfterClone == 'function' && nuAfterClone() == false) {
return;
}
}
nuSetHash('pr_status','NEW');
$('#pr_status').val('NEW');
nuSetHash('pr_status','NEW');
$('#pr_status').val('NEW');
nuBuildForm(w);
function nuSetHash(name, value){
nuFORM[name] = value;
}
Users browsing this forum: No registered users and 4 guests