Select to view content in your preferred language

"Cannot set property 'geometry' of undefined": Survey fails to submit with geopoint questions in repeat groups in the web application

2357
7
10-06-2017 12:40 AM
leo_SwissGIS
New Contributor III

We are using a form that contains two repeat groups and each of these groups contains a geopoint question. The simplified structure of the form is as follow:

   geopoint question

   begin group1:

      begin repeat1:

         geopoint question

      end repeat1

   end group1

   begin group2:

      begin repeat2:

         geopoint question

      end repeat2

   end group2

The expected result in that case should be one main table containing the answers of the main form and two related tables containing the answers of the repeat groups, with a given location for each repetition of the repeat answers.

The form works as expected with the Survey123 app. However we want our clients to answer through the web application. After filling the form, when submitting in a browser (chrome), loading for a while, a message appears:

"Cannot set property 'geometry' of undefined" and the form fails to submit. Depending on the browser, sometimes there is no message and the form is submitting indefinitely (Edge or Firefox).

The result is the same for any browser when we check ArcGIS online : the answers of the main form are apparently submitted but the related tables are empty.

The problem disappears when there is only one repeat group: successful submission and expected results in ArcGIS online.

I attached a very simplified form in order to illustrate and reproduce the issue.

Any idea from where it could come from and how to fix this issue?

0 Kudos
7 Replies
JohnathanHasthorpe
Esri Regular Contributor

Hi Leo

It looks like you have found a bug. The cause of the error is having more that one repeats containing a geopoint in the survey. I will raise this with our development team and update this post when we are in a position to resolve.

Thanks

John

leo_SwissGIS
New Contributor III

Hi John

Thank you for your answer.

Do you know in which time frame the issue might be solved?

As this function is central in our public survey that will start within a month, we would like to know if we have to think of an alternative solution or if there is a chance that it will be addressed quickly.

It seems to me that fixing this bug is crucial for the good usage of the web application and the new possibilities it offers with geoforms.

Thank you for keeping us informed

Leo

0 Kudos
JohnathanHasthorpe
Esri Regular Contributor

This issue should now be resolved

0 Kudos
by Anonymous User
Not applicable

version 3.22

I am having a similar issue. error message "Uncaught TypeError: Cannot read property 'execute' of undefined" 

function executeIdentifyTask (event) {
identifyParams.geometry = event.mapPoint; 
identifyParams.mapExtent = map.extent;
var deferred = identifyTask
console.log(identifyParams)

     Returned values from console:

  1. {layerOption: "top", geometry: {…}, mapExtent: {…}}
    1. geometry:{type: "point", x: -9530843.887140024, y: 5634056.789779264, spatialReference: {…}}
    2. layerOption:"top"
    3. mapExtent:{type: "extent", xmin: -10618084.17746808, ymin: 5000546.699351891, xmax: -9461133.317343961, ymax: 5915345.053868637, …}
    4. __proto__:Object


.execute(identifyParams); ...Fails here
deferred.addCallback(function (response) {
// response is an array of identify result objects
// Let's return an array of features.
return arrayUtils.map(response, function (result) {
var feature = result.feature;
var layerName = result.layerName;

});
});

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Rnady,

This looks like an issue with the JavaScript API, not Survey123; to my knowledge, the Survey123 website doesn't use version 3.22.  Where are you experiencing this error?

0 Kudos
by Anonymous User
Not applicable

Not sure if I can explain what is going on here but basically I am trying to read the pixel value that represents a precipitation accumulation from the MRMS(a satellite precipitation estimation product). When the code is isolated in a single purpose application it works but when integrated into a much larger app I get this error. I have checked rechecked all the modules thoroughly and unless there is a conflict, that does not seem to be the problem. The values returned from the console log are correct but somehow they are not seen by the ".execute" directive(one I am not familiar with). If it helps I am providing a snippet but I can zip the entire file and send it along if you like. 

"<--map.on("load", mapReady);
function mapReady () {
identifyParams = new IdentifyParameters();
map.on("click", executeIdentifyTask);
//create identify tasks and setup parameters
identifyTask = new IdentifyTask(qpe);
identifyParams.tolerance = 1;
identifyParams.returnGeometry = true;
identifyParams.layerIds = [3,7,11,15,19,23,27];
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
identifyParams.width = map.width;
identifyParams.height = map.height;
}

function executeIdentifyTask (event) {

identifyParams.geometry = event.mapPoint;
identifyParams.mapExtent = map.extent;
var deferred = identifyTask;
identifyParams=identifyParams;
.execute(identifyParams);
deferred.addCallback(function (response) {
// response is an array of identify result objects
// Let's return an array of features.
return arrayUtils.map(response, function (result) {
var feature = result.feature;
var layerName = result.layerName;
//alert(result);
feature.attributes.layerName = layerName;
var precipTemplate = new InfoTemplate(layerName,
"Inches Precipitation : " + (Math.round(feature.attributes[ 'Pixel Value']*100))/100);
feature.setInfoTemplate(precipTemplate);
return feature;
});
});

// InfoWindow expects an array of features from each deferred
// object that you pass. If the response from the task execution
// above is not an array of features, then you need to add a callback
// like the one above to post-process the response and return an
// array of features.
map.infoWindow.setFeatures([deferred]);
map.infoWindow.show(event.mapPoint);
}-->"

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Thanks Rnady, 

This is probably better addressed in https://community.esri.com/community/developers/web-developers/arcgis-api-for-javascript .  The being said, your .execute function isn't being called off any object; shouldn't it be identifyTask.execute(identifyParams) ?

0 Kudos