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.

Javascript error when adding a new record

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Paul
Posts: 66
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 13 times
Been thanked: 2 times

Javascript error when adding a new record

Post by Paul »

When ckicking on the Save button for a new record, this error appears:
"Uncaught TypeError: Cannot read properties of null (reading 'style') Please check the browser developer console for details."

Console reads as follows:
nuform.js?ts=20250926015343:4957 Uncaught TypeError: Cannot read properties of null (reading 'style')
at nuSetBrowseColumns (nuform.js?ts=20250926015343:4957:12)
at nuDragTitleEvents (nucommon.js?ts=20250926015343:2150:2)
at nuBuildForm (nuform.js?ts=20250926015343:145:2)
at Object.successCallback (nuajax.js?ts=20250926015343:193:4)
at c (jquery-3.7.1.min.js:2:25304)
at Object.fireWith [as resolveWith] (jquery-3.7.1.min.js:2:26053)
at l (jquery-3.7.1.min.js:2:77782)
at XMLHttpRequest.<anonymous> (jquery-3.7.1.min.js:2:80265)
The error Uncaught TypeError: Cannot read properties of null (reading 'style') means that your code is trying to access the style property of a variable that is currently null. In the context of the DOM, this usually happens when you try to manipulate the style of an HTML element that doesn't exist or hasn't been found by your JavaScript code. The error stack trace indicates that this is happening within the nuSetBrowseColumns function in the nuform.js file, specifically on line 4957.

Lines 4853 to 4860 of nuform.js file:

Code: Select all

function nuSetBrowseColumns(columnWidths) {

	const padding = nuTotalWidth('nucell_0_0') - $('#nucell_0_0').width();
	let left = 7;

	columnWidths.forEach((width, i) => {
		const columnElements = document.querySelectorAll(`[data-nu-column="${i}"], #nuBrowseTitle${i},#nuBrowseTitle${i}_select`);

		columnElements.forEach(element => {
			element.style.left = `${left}px`;
			element.style.width = `${width}px`;
		});

		left += width + (width === 0 ? 0 : padding);
	});

	const browseFooterWidth = left - 7;

	$('#nuBrowseFooter').css('width', `${browseFooterWidth}px`);

	nuFORM.breadcrumbs[nuFORM.breadcrumbs.length - 1].column_widths = columnWidths;

	if (nuCurrentProperties().browse_filtered_rows === 0) {
		const nucell00 = document.getElementById('nucell_0_0');
** 4957 >>>	nucell00.style.width = `${browseFooterWidth - 22}px`;
		nucell00.style.zIndex = '2';

		$("div[id^='nucell_']").not('#nucell_0_0').hide();
	}

}
kev1n
nuBuilder Team
Posts: 4522
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 515 times
Contact:

Re: Javascript error when adding a new record

Post by kev1n »

This error was most likely caused by invalid custom code in your form.
Paul
Posts: 66
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 13 times
Been thanked: 2 times

Re: Javascript error when adding a new record

Post by Paul »

Do the error messages provide you with enough information to point me in the right direction of where to look for the problem?
steven
Posts: 394
Joined: Mon Jun 15, 2009 10:03 am
Has thanked: 58 times
Been thanked: 54 times

Re: Javascript error when adding a new record

Post by steven »

Hi Paul,

If you gave us a copy of your database backup - withholding any personal information or business secrets.

We could answer you bettter.


Steven
Paul
Posts: 66
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 13 times
Been thanked: 2 times

Re: Javascript error when adding a new record

Post by Paul »

Ok, should I post it here?
kev1n
nuBuilder Team
Posts: 4522
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 515 times
Contact:

Re: Javascript error when adding a new record

Post by kev1n »

Yes, you can
Paul
Posts: 66
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 13 times
Been thanked: 2 times

Re: Javascript error when adding a new record

Post by Paul »

Here is a backup from yesterday morning.
Last edited by Paul on Fri Sep 26, 2025 6:54 am, edited 1 time in total.
Paul
Posts: 66
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 13 times
Been thanked: 2 times

Re: Javascript error when adding a new record

Post by Paul »

Let me know when you have it so I can delete it from the post.
kev1n
nuBuilder Team
Posts: 4522
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 515 times
Contact:

Re: Javascript error when adding a new record

Post by kev1n »

Downloaded.
kev1n
nuBuilder Team
Posts: 4522
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 515 times
Contact:

Re: Javascript error when adding a new record

Post by kev1n »

I opened your form Spirit ITC Investigations, added a new record, and clicked Save. No error came up on my end.
Did you take any other steps? Did you add any other JS code that is not contained in this backup?
Post Reply