Thanks Ronnie,
You have described what causes this issue well. The issue is that when publishing a default value of 0 or null is added, which is automatically added when editing in Javascript Applications. It was built this way to support the workflows in the past, but now results in an unideal user experience. There is a way to workaround this with ArcGIS Online Feature Services. When publishing a default value is added to the editing template. This default value can be changed to null through the feature Services admin API, which will result in records without required fields being rejected.
You can see this behaviour with the following web map where i modified the template for the field RatsFound to have a default of null:
http://arcg.is/1fL99W
https://services5.arcgis.com/cuQhNeNcUrgLmYGD/ArcGIS/rest/services/Rat_Tracker/FeatureServer/0?f=pjs...
To change this you will need to access the feature service admin api, and modify the template to include null the correct template value.
In this example, I changed the template from example A To example B in the updatedefinition call of the feature service admin:
Example A: Space for default value
{
"templates": [
{
"name": "Rats",
"description": "",
"drawingTool": "esriFeatureEditToolPolygon",
"prototype": {
"attributes": {
"Inspection": null,
"DogBreed": null,
"RatsFound": ""
}
}
}
]
}
Example B: null for default value
{
"templates": [
{
"name": "Rats",
"description": "",
"drawingTool": "esriFeatureEditToolPolygon",
"prototype": {
"attributes": {
"Inspection": null,
"DogBreed": null,
"RatsFound": null
}
}
}
]
}