I have an application where I am using the editing functionality. It works as long as I enter information for all fields, but if any field are missing information, I receive Unable to perform applyEdits error.
My live application is at:http://maps.decaturil.gov/streetsignshttp://geonet.esri.com/
My github project is at: https://github.com/csergent45/streetSigns/tree/176dbb8a76f3773964ab25987f8e4f8cabcc9308
and here is the error that I am receiving:
If I enter data in for all fields, the application runs without a hitch. The JavaScript file is in the app folder named main.js.
Any ideas?
Solved! Go to Solution.
My guess is that your integer fields & date field do not like to be empty (supportID, addrCode and dateInv). I'd start there. If they need to be required, I'd scrub the form data and force a default value that means nothing (-9999 / '1900-01-01').
This works... (Form payload)
[{"geometry":{"x":796086.8072222222,"y":1176275.4861111112,"spatialReference":{"wkid":3435}},"attributes":{"address":"test","supportId":"1","type":"Single Post","size":"12in. tube","material":"","base":"","rating":"","dateInv":"2015-04-22","inspector":"K. Morgan","comments":"","addrCode":"1"}}]
While this fails... (Form payload)
[{"geometry":{"x":796086.8072222222,"y":1176275.4861111112,"spatialReference":{"wkid":3435}},"attributes":{"address":"test","supportId":"","type":"Single Post","size":"12in. tube","material":"","base":"","rating":"","dateInv":"","inspector":"K. Morgan","comments":"","addrCode":""}}]
Pretty please...
Also, you will want to delete all of the records near that geometry ("geometry":{"x":796086.8072222222,"y":1176275.4861111112,"spatialReference":{"wkid":3435}}) with "inspector" 'K. Morgan'. Tried to pick an area where there wasn't any edits for clean-up purposes.
My guess is that your integer fields & date field do not like to be empty (supportID, addrCode and dateInv). I'd start there. If they need to be required, I'd scrub the form data and force a default value that means nothing (-9999 / '1900-01-01').
This works... (Form payload)
[{"geometry":{"x":796086.8072222222,"y":1176275.4861111112,"spatialReference":{"wkid":3435}},"attributes":{"address":"test","supportId":"1","type":"Single Post","size":"12in. tube","material":"","base":"","rating":"","dateInv":"2015-04-22","inspector":"K. Morgan","comments":"","addrCode":"1"}}]
While this fails... (Form payload)
[{"geometry":{"x":796086.8072222222,"y":1176275.4861111112,"spatialReference":{"wkid":3435}},"attributes":{"address":"test","supportId":"","type":"Single Post","size":"12in. tube","material":"","base":"","rating":"","dateInv":"","inspector":"K. Morgan","comments":"","addrCode":""}}]
Pretty please...
Also, you will want to delete all of the records near that geometry ("geometry":{"x":796086.8072222222,"y":1176275.4861111112,"spatialReference":{"wkid":3435}}) with "inspector" 'K. Morgan'. Tried to pick an area where there wasn't any edits for clean-up purposes.
I would also set the form field types to the correct behaviour of the back-end...
IE: Change text fields to number fields for supportID and addrCode
I just updated the field types. That didn't help. I was hoping it would have.
It does look like it trying to place text into my date and number fields. Now I just need to figure out how to strip out the "" for those fields and then it may work.
Thanks for your help.
I haven't looked at your code yet but in the past, I stop the default form events, scrub the form data as I populate a JSON object and post to the server using dojo XHR.
I'm not sure how to do that. I'll work with the form the best I can.
I'll look through your code later tonight on github and see what I can do to help.
Chris,
It sounds like your fields don't allow null values but I would check your server logs to see if there are more informative errors.
-Dan
I ran afoul this same issue with my forms, and the issue was with having a manual date field and a space in the value field (or a null value). I changed the date to an auto variable and also set all of my fields to allow Null values. I also noticed that I had a comments field that, during testing, was set to only have 10 characters so inputting a string like "This is where I saw the leprechaun" would throw the same error.