Page 1 of 1

Uncaught TypeError: Cannot read properties of null (reading 'style') when Cloning a record

Posted: Mon Oct 13, 2025 7:34 pm
by Paul
When I am in the Edit form and viewing a record:
1. I click "Clone"
2. Click "Save"
OBSERVE:

Code: Select all

Uncaught TypeError: Cannot read properties of null (reading 'style')
    at nuSetBrowseColumns (nuform.js:4960:12)
    at nuDragTitleEvents (nucommon.js:2150:2)
    at nuBuildForm (nuform.js:140:1)
    at Object.successCallback (nuajax.js: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)


Line 4960 of nuform.js:
nucell00.style.zIndex = '2';
Contents of Edit js:

Code: Select all

if (nuIsNewRecord()) {
        // Set the value of the select object
        nuSetValue('pk_finalDoughIngred1','sourdough starter');
	nuSetValue('pk_finalDoughIngred2','water');
	nuSetValue('pk_finalDoughIngred3','salt');
        
    }
I recently added a Display object that displays the current record ID in the Edit form:
The object ID is: 'myrecordnumber'
The display SQL is:

Code: Select all

select table1_id from table1 where table1_id = '#RECORD_ID#';
I can create NEW records without any problems.

Re: Uncaught TypeError: Cannot read properties of null (reading 'style') when Cloning a record

Posted: Tue Oct 14, 2025 3:19 am
by kev1n
Can you share a screenshot of the object properties and the actual SQL used?

Re: Uncaught TypeError: Cannot read properties of null (reading 'style') when Cloning a record

Posted: Tue Oct 14, 2025 3:43 am
by Paul
myrecordnumber.PNG
myrecordnumber-sql.PNG

Re: Uncaught TypeError: Cannot read properties of null (reading 'style') when Cloning a record

Posted: Tue Oct 14, 2025 3:45 am
by Paul
It displays with no problems.
recordnum.PNG

Re: Uncaught TypeError: Cannot read properties of null (reading 'style') when Cloning a record

Posted: Tue Oct 14, 2025 6:59 am
by Paul
Console info: (I am not sure how to interpret this. Help?)

Code: Select all

Explanation

Understanding the problem
The error Uncaught TypeError: Cannot read properties of null (reading 'style') means that you are trying to access the style property of a variable that is currently null. In this specific case, the error occurs on line 4960 of nuform.js within the nuSetBrowseColumns function. The code on that line is trying to access the style property of an element that could not be found.

How to verify
You can set a breakpoint on line 4960 in nuform.js in the Sources panel of DevTools. When the code execution pauses at this line, hover over the variable that you are trying to access the style property from. Its value will likely be null. You can also check the call stack in the right-hand sidebar to see how the nuSetBrowseColumns function was called, which might provide clues about why the element was not found.

Suggested fix
The most common reason for this error is trying to access a DOM element before it has been loaded on the page, or if the selector used to find the element is incorrect. Ensure that the element you are trying to access exists in the DOM when the nuSetBrowseColumns function is executed. You can wrap the code that accesses the element within a DOM ready event listener or check if the element exists before trying to access its properties.

Re: Uncaught TypeError: Cannot read properties of null (reading 'style') when Cloning a record

Posted: Tue Oct 14, 2025 7:19 am
by Paul
I found the problem - it was incorrect integer data in the database for two fields. I changed the datatype for each of them and then deleted the bad data - that fixed it.