Welcome to the nuBuilder Forums!

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

NuShow() - strange behavior

Questions related to customising nuBuilder Forte with JavaScript or PHP.
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

NuShow() - strange behavior

Unread post by kknm »

In one main form procedure I call two nuShow ('sub_jurw_if') and nuShow ('but_ok')
Only the subform appears. If you comment out either of the two, it works separately.

Code: Select all

    var dep = $('#obz_dep');    
    var comp = $('#obz_com');
    var dat = new Date().toLocaleDateString();
    $("#sub_jurw_if000dep").val(dep.val());
    $("#sub_jurw_if000computer").val(comp.val());    
    $("#sub_jurw_if000jur_wdata").val(dat); 
    nuShow('sub_jurw_if');
    nuShow('but_ok');   
Initially the subform and button are hidden.
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: NuShow() - strange behavior

Unread post by kknm »

Added a few more different hidden objects and as many nuShow() to LaunchForm.
Only one object becomes visible anyway. This is not the case in nuBuilder4.
kev1n
nuBuilder Team
Posts: 4301
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: NuShow() - strange behavior

Unread post by kev1n »

I justed tested it with an old nuBuilder 4 installation by setting the Access of an object to hidden and calling

Code: Select all

nuShow('hidden_object')


Result: The object didn't show up.
kev1n
nuBuilder Team
Posts: 4301
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: NuShow() - strange behavior

Unread post by kev1n »

I'll have to investigate. For the time being, you can try forceShow() instead of show()

Code: Select all

function forceShow(i, tab) {
	$('#'+ i).attr('data-nu-tab', 'x'+tab);
	$('#label_'+i).attr('data-nu-tab', 'x'+tab);
	nuShow(i);
}

Code: Select all

forceShow('sub_jurw_if', '0'); // 0 means the object is on the first tab, 1 = 2nd tab etc.
forceShow('but_ok', '0');
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: NuShow() - strange behavior

Unread post by kknm »

ForceShow () did not work for me in one function. Added another function with normal nuShow (). The errors in the debugger are the same, but both objects become visible.

Code: Select all

nucommon.js?ts=20210409081413:2052 Argument #2 is not an array in nuAddDatalist()

nucommon.js?ts=20210409081413:983 Uncaught TypeError: Cannot read property 'id' of undefined
    at nuShow (nucommon.js?ts=20210409081413:983)
    at add_jurw (<anonymous>:21:5)
    at HTMLButtonElement.onclick ((index):1)
nuShow @ nucommon.js?ts=20210409081413:983
add_jurw @ VM2136:21
onclick @ (index):1
nucommon.js?ts=20210409081413:983 Uncaught TypeError: Cannot read property 'id' of undefined
    at nuShow (nucommon.js?ts=20210409081413:983)
    at HTMLDivElement.onchange ((index):1)
kev1n
nuBuilder Team
Posts: 4301
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: NuShow() - strange behavior

Unread post by kev1n »

If you just call

Code: Select all

forceShow('sub_jurw_if', '0');
and nothing else, does that error also appear?
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: NuShow() - strange behavior

Unread post by kknm »

kev1n wrote:If you just call

Code: Select all

forceShow('sub_jurw_if', '0');
and nothing else, does that error also appear?
Yes...

Code: Select all

nucommon.js?ts=20210409100338:2052 Argument #2 is not an array in nuAddDatalist()
nuAddDatalist @ nucommon.js?ts=20210409100338:2052
nuINPUT @ nuform.js?ts=20210409100338:745
nuBuildEditObjects @ nuform.js?ts=20210409100338:546
nuBuildForm @ nuform.js?ts=20210409100338:164
successCallback @ nuajax.js?ts=20210409100338:117
success @ nuajax.js?ts=20210409100338:17
c @ jquery.js?ts=20210409100338:2
fireWith @ jquery.js?ts=20210409100338:2
l @ jquery.js?ts=20210409100338:2
(anonymous) @ jquery.js?ts=20210409100338:2
load (async)
send @ jquery.js?ts=20210409100338:2
ajax @ jquery.js?ts=20210409100338:2
nuAjax @ nuajax.js?ts=20210409100338:8
nuForm @ nuajax.js?ts=20210409100338:122
nuGetBreadcrumb @ nucommon.js?ts=20210409100338:123
onclick @ (index):1
nucommon.js?ts=20210409100338:983 Uncaught TypeError: Cannot read property 'id' of undefined
    at nuShow (nucommon.js?ts=20210409100338:983)
    at forceShow (<anonymous>:46:4)
    at add_jurw (<anonymous>:22:5)
    at HTMLButtonElement.onclick ((index):1)
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: NuShow() - strange behavior

Unread post by kknm »

Calling the function

Code: Select all

JSON.stringify(nuSubformObject(''));
not observing the buttons and subform objects.

Code: Select all

"{"id":"nuBuilder4EditForm","foreign_key":"","primary_key":"obz_id","object_id":"605899466482e56","table":"obzor","action":"save","rows":[["-1",0,"","","","","","[]"]],"columns":[[],[],[],[],[],[],[]],"chartData":[[null,null,null,null,null,null],[0,0,0,0,0,0]],"chartDataPivot":[[null,0],[null,0],[null,0],[null,0],[null,0],[null,0]],"edited":[[0,0,0,0,0,0,0,0]],"deleted":[0],"fields":["ID","nuDelete","obz_dep","obz_com","obz_pr","obz_kart","obz_d","sel"]}"
kev1n
nuBuilder Team
Posts: 4301
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: NuShow() - strange behavior

Unread post by kev1n »

Is there anything (invalid or spaces) in the Datalist field?
You do not have the required permissions to view the files attached to this post.
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: NuShow() - strange behavior

Unread post by kknm »

Yes !
One of the fields had a space in the datalist.The first mistake is gone.
Last edited by kknm on Fri Apr 09, 2021 9:54 am, edited 1 time in total.
Post Reply