Why am I receiving an "Unable to perform applyEdits error?

5257
20
Jump to solution
04-22-2015 01:34 PM
ChrisSergent
Regular Contributor III

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:

streetSignsError.png

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?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
KyleMorgan
New Contributor III

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.

Delete Me.png

View solution in original post

20 Replies
KyleMorgan
New Contributor III

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.

Delete Me.png

KyleMorgan
New Contributor III

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

ChrisSergent
Regular Contributor III

I just updated the field types. That didn't help. I was hoping it would have.

0 Kudos
ChrisSergent
Regular Contributor III

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.

0 Kudos
KyleMorgan
New Contributor III

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.

ChrisSergent
Regular Contributor III

I'm not sure how to do that. I'll work with the form the best I can.

0 Kudos
KyleMorgan
New Contributor III

I'll look through your code later tonight on github and see what I can do to help.

DanielStauning
Esri Contributor

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

0 Kudos
williamcarr
Occasional Contributor II

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.