Cannot read properties of null/undefined

03-31-2022 07:45 AM
Occasional Contributor III

I have a public Survey123 form (published from Connect 3.14) that is going to be used to allow farmers to bid for cover crop funding, using the web form rather than the app. Part of the process involves them drawing a polygon for each field [as in farmer's fields, not attribute fields!] that they are bidding for (geoshape question within a repeat).

I've tried setting it up a couple of different ways and get a subtly different error each time. Basically the map in the first repeat displays correctly but the map any subsequent repeats never load completely - they appear to load the map in the background but the white pulsing progress bar never disappears. 

Firstly I had a question called field count (default value of 1) which was used to set the repeat count and automatically add that number of repeats.  In the browser console I can see the following error being generated when I update the value in the question for the field count - in this case I put a field count of 13, so there are 12 errors displayed, one for each new repeat it is trying to create. Whatever I change the number of fields to the error count is always that number minus one.

12 app-render-v3.14.113.chunk.js:2

Uncaught TypeError: Cannot read properties of undefined (reading 'addClass')
at survey123_repeatGroup_Survey123RepeatGroupWidget._addPaginateItem (app-render-v3.14.113.chunk.js:2:516564)
at app-render-v3.14.113.chunk.js:2:504831
at HTMLElement.<anonymous> (app-commons-v3.14.113.chunk.js:2:178338)
at Object.add (app-render-v3.14.113.chunk.js:2:178631)
at Object.updateRepeatInstancesFromCount (app-render-v3.14.113.chunk.js:2:177296)
at Array.forEach (<anonymous>)
at Object.countUpdate (app-render-v3.14.113.chunk.js:2:177755)
at Boolean.<anonymous> (app-render-v3.14.113.chunk.js:2:641140)
at Array.forEach (<anonymous>)
at HTMLDivElement.<anonymous> (app-render-v3.14.113.chunk.js:2:64112


Secondly I tried removing the reliance on the field count question and just got the user to manually add as many repeats as they require. This produced the following error in the browser console


Uncaught (in promise) TypeError: Cannot read properties of null (reading 'clone')
at survey123_polygon_Survey123PolygonWidget._centerViewByPolygon (app-render-v3.14.113.chunk.js:2:598163)
at app-render-v3.14.113.chunk.js:2:594583 

Thirdly I tried setting the default value on the field count question to 10 thinking that maybe it would be happier if it created all the repeats on first loading and then the user could just add or remove any that they don't need. However it looks like it doesn't actually trigger the problematic code in this scenario until I try to remove onto another repeat and I get the same error message as the second time above.

Have also tried drawing a polygon first before moving onto the next repeat in case that is the null that is being referred to, but no difference.

The only other thing I can think of is that the reference layers being used in my map are in British National Grid coordinate systems whereas the basemap will be WGS84 so it is presumably reprojecting on the fly. I will have a go at projecting to WGS84 before uploading and see if that makes a difference.

Tags (1)
0 Kudos
1 Reply
Occasional Contributor III

Just a quick update. Tried republishing the layers in my map in WGS84 but that made no difference. Tried rolling the survey back to 3.13 and the maps load correctly in the repeats so it looks like a bug with version 3.14 maybe?

0 Kudos