Page 1 of 3

Javascript error when adding a new record

Posted: Fri Sep 26, 2025 2:04 am
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();
	}

}

Re: Javascript error when adding a new record

Posted: Fri Sep 26, 2025 5:32 am
by kev1n
This error was most likely caused by invalid custom code in your form.

Re: Javascript error when adding a new record

Posted: Fri Sep 26, 2025 6:21 am
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?

Re: Javascript error when adding a new record

Posted: Fri Sep 26, 2025 6:27 am
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

Re: Javascript error when adding a new record

Posted: Fri Sep 26, 2025 6:39 am
by Paul
Ok, should I post it here?

Re: Javascript error when adding a new record

Posted: Fri Sep 26, 2025 6:41 am
by kev1n
Yes, you can

Re: Javascript error when adding a new record

Posted: Fri Sep 26, 2025 6:47 am
by Paul
Here is a backup from yesterday morning.

Re: Javascript error when adding a new record

Posted: Fri Sep 26, 2025 6:49 am
by Paul
Let me know when you have it so I can delete it from the post.

Re: Javascript error when adding a new record

Posted: Fri Sep 26, 2025 6:51 am
by kev1n
Downloaded.

Re: Javascript error when adding a new record

Posted: Fri Sep 26, 2025 7:15 am
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?