I have got this error" Cannot read property 'value' of null" and not sure whats wrong with my code? I have some inputs in my popup that users can edit them, and I want to save edits.
view.popup.on("trigger-action", function(event) {
if (event.action.id === "edit") {
setupEditing(searchResults[arraypos]);
console.log(this);
}
if (event.action.id === "update") {
editFeature.attributes["common_name"] = document.getElementById('commonName').value;
editFeature.attributes["scientificname"] = document.getElementById('sientificName').value;
editFeature.attributes["family"] = document.getElementById('family').value;
var edits = {
updateFeatures: [editFeature]
};
console.log(editFeature.attributes);
tree.applyEdits({updates:[edits]}).then(response => console.log(response));
}
});
}
and here are my ids that seems correct:
function setupEditing(sr) {
esripopupcontent = document.getElementsByClassName('esri-popup__content')[0];
esripopupcontent.innerHTML = "<table><tr><td>Common Name</td><td><input value=" + commonname + " id= commonName/></td></tr><tr><td>Scientific Name</td><td><input value=" + scientificname + " id= sientificName /></td></tr><tr><td>family</td><td><input value="+ family + " id= family/></td></tr></table>";