HOW TO
The ability to disable editing a web map is possible using JavaScript by implementing the drawToolbar.deactivate() and editToolbar.deactivate() functions in a script.
To set a certain number of allowable edits in a web map configured using ArcGIS API for JavaScript before editing is disabled, the script requires a counter with a preset number that triggers the deactivate function when the counter reaches the specified number.
... //Set up the counter for graphic added count = count + 1; console.log("Graphic Count", count); ...
... //Editing is enabled for 3 or less edit points if(count <= 3) { appliedEdits = selectedTemplate.featureLayer.applyEdits([newGraphic], null, null); } else { drawToolbar.deactivate(); editToolbar.deactivate(); alert(" You have successfully completed 3 edits!"); } return count; }); ...
Note: Edit the code segment, "if(count <= 3)" with the desired number of edits allowed.
Get help from ArcGIS experts
Download the Esri Support App