Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

nuEnable() - correction

Questions related to using nuBuilder Forte.
Locked
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

nuEnable() - correction

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

        }
    }
}
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: nuEnable() - correction

Unread post by marc »

Toms, thanks for the fix. I came across this bug, too.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: nuEnable() - correction

Unread post 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.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuEnable() - correction

Unread post by admin »

guys,

I have updated GitHub.

Thanks.


Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: nuEnable() - correction

Unread post by toms »

Thanks!
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuEnable() - correction

Unread post by admin »

.
Locked