Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Questions related to customising nuBuilder Forte with JavaScript or PHP.
kknm
Posts: 377 Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:
Unread post
by kknm » Mon Apr 01, 2024 10:42 am
There are 3 diagrams on the page. Two of them are in the same position. I need to switch their visibility using a button. Only one of them should be visible at a time.
Code: Select all
function visi(event) {
if (nuIsHidden('dia_sh_m')==false) {
nuHide('dia_sh_m');
nuShow('dia_sh_m1');
}else {
nuHide('dia_sh_m1');
nuShow('dia_sh_m');
}
}
With this approach, everything works as it should, but in the console I see errors -
Code: Select all
nucommon.js?ts=20240401105906:1311 Uncaught TypeError: Cannot read properties of undefined (reading 'id')
at nuShow (nucommon.js?ts=20240401105906:1311:73)
at visi (<anonymous>:23:9)
at HTMLButtonElement.onclick (index.php:1:37)
kev1n
nuBuilder Team
Posts: 4562 Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:
Unread post
by kev1n » Mon Apr 01, 2024 10:55 am
What version of nuBuilder are you using? (Options menu -> Version Info)
kknm
Posts: 377 Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:
Unread post
by kknm » Mon Apr 01, 2024 12:05 pm
V.4.5-2024.03.05.02
kev1n
nuBuilder Team
Posts: 4562 Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:
Unread post
by kev1n » Mon Apr 01, 2024 12:32 pm
It looks like there is somehow no tab selected/it does not exist. Have you removed any tabs from your form or changed anything else?
This code fails:
Code: Select all
$('.nuTabSelected')[0].id.substr(5);
kknm
Posts: 377 Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:
Unread post
by kknm » Mon Apr 01, 2024 12:58 pm
'dia_sh_m' and 'dia_sh_m1'- these are not tabs but HTML objects (diagrams) on one tab.
kev1n
nuBuilder Team
Posts: 4562 Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:
Unread post
by kev1n » Mon Apr 01, 2024 1:50 pm
Yes but the error is caused because there seem to be no (active) tabs.
kknm
Posts: 377 Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:
Unread post
by kknm » Tue Apr 02, 2024 7:59 am
What do you mean no active tabs?
This is a LAUNCH form on which 3 diagrams (apex-chart) are placed, described in an HTML object. 2 of them overlap each other. Their visibility is toggled with a button and works correctly, but I have doubts - am I correctly referring to HTML objects simply by name?
dia.png
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4562 Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:
Unread post
by kev1n » Tue Apr 02, 2024 8:05 am
nuShow() and nuHide() call a function to update the active tab. If for some reason there is none, you'll get the above error.
tabs.png
You do not have the required permissions to view the files attached to this post.
kknm
Posts: 377 Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:
Unread post
by kknm » Tue Apr 02, 2024 8:25 am
I have an active tab, judging by the form properties, and I have permissions for the user.
dia1.png
dia_permiss.png
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4562 Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:
Unread post
by kev1n » Tue Apr 02, 2024 8:29 am
And that tab is visible on your form?