Page 1 of 1

nuEnable() - correction

Posted: Thu Aug 30, 2018 12:22 pm
by toms
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:

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,"");
		})
		
	}

}
Correction:

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, "");
                })

        }
    }
}

Re: nuEnable() - correction

Posted: Sun Sep 02, 2018 10:54 am
by marc
Toms, thanks for the fix. I came across this bug, too.

Re: nuEnable() - correction

Posted: Mon Sep 03, 2018 7:34 am
by toms
@marc: If you can't wait for an official fix, insert the corrected function under setup -> header.
This will override the original one.

Re: nuEnable() - correction

Posted: Tue Sep 04, 2018 2:43 am
by admin
guys,

I have updated GitHub.

Thanks.


Steven

Re: nuEnable() - correction

Posted: Tue Sep 04, 2018 9:11 am
by toms
Thanks!

Re: nuEnable() - correction

Posted: Tue Sep 04, 2018 11:57 pm
by admin
.