nuEnable() - correction
Posted: Thu Aug 30, 2018 12:22 pm
Hi,
if(c == 2) never returns true. It must be called inside the for loop.
So if a lookup object is disabled with nuDisable(), the lookup button will no longer work when you call nuEnable(), because the click event will not be set again.
Current code:
Correction:
if(c == 2) never returns true. It must be called inside the for loop.
So if a lookup object is disabled with nuDisable(), the lookup button will no longer work when you call nuEnable(), because the click event will not be set again.
Current code:
Code: Select all
function nuEnable(i){ //-- Enable Edit Form Object
var o = [i, i + 'code', i + 'button', i + 'description'];
for(var c = 0 ; c < o.length ; c++){
$('#' + o[c])
.removeClass('nuReadonly')
.prop('readonly', false)
.prop('disabled', false);
}
if(c == 2){ //-- button
$('#' + o[c])
.on( "click", function() {
nuBuildLookup(this,"");
})
}
}
Code: Select all
function nuEnable(i) { //-- Enable Edit Form Object
var o = [i, i + 'code', i + 'button', i + 'description'];
for (var c = 0; c < o.length; c++) {
$('#' + o[c])
.removeClass('nuReadonly')
.prop('readonly', false)
.prop('disabled', false);
if (c == 2) { //-- button
$('#' + o[c])
.on("click", function () {
nuBuildLookup(this, "");
})
}
}
}