I am Creating Map with some areas drawn as polygons. Each area have property AreaNumber. AreaNumber is given in input under map.
Problem is: How to cancel drawing if AreaNumber is not written in input?
Possible solutions make user unable to press create button while input is empty with popup message, or Cancel in map.on(draw: drawstart) if input is empty after giving popup message. How to call cancel buttons function from code?
I didnt find a way to call cancel button. But was able to find a way to cancell drawing by removing draw control then adding it again, whenever i need it.
Example:
map.on("draw:drawstart", function (e) {
var err = PsNumber.value;
if (err == '') {
alert("Alert popup");
map.removeControl(drawControl);
map.addControl(drawControl);
}
});
Code will show error and cancel drawing automatically.