Closed flyinb closed 8 years ago
@flyinb can you please provide a console.log stack trace?
It doesn't produce a console error, the posed JSON data is broken. You can reproduce the error by putting an "&" in an attribute field, going offline (queue edit in offline local database), then going online. The data gets posted, but anywhere there is an "&" symbol, the JSON thinks it's a new posted variable, and not part of a string.
I fixed it by URI encoding
encodeURIComponent(property);
but as i said before, online works fine, it's only offline edits
it has knock on effects (I have to decode via an interceptor)
Uri.UnescapeDataString(HttpUtility.UrlDecode(att.Value.ToString()));
but i shouldn't have to do this!
There is a console error: EDIT REQUEST RESPONSE WAS NOT SUCCESSFUL: {"error":{"code":400,"message":"Cannot perform operation. Invalid operation parameters.","details":["'updates' parameter is invalid","Unterminated string passed in.
This error makes sense because the library doesn't do any encoding when it overrides returning edits after an offline event. Reference OfflineEditAdvanced.js Line 2010
I'll take a stab at adding encoding. This is a minor enhancement if it works, and then this library will be in compliance with the JS API v3.x.
@flyinb this will be fixed in v3.3.0. I'll push the build in just a few minutes. Let me know if you have any other problems with it.
thanks. :)
arcgis-3.14.min.js:144 Uncaught TypeError: Cannot read property 'setAttribute' of nullb.set @ arcgis-3.14.min.js:144(anonymous function) @ /Scripts/esri/offline-edit-src.js:943transaction.oncomplete @ /Scripts/esri/offline-edit-src.js:2537 /Scripts/esri/offline-edit-src.js:512 All edits done
DIT REQUEST REPONSE WAS NOT SUCCESSFUL: XMLHttpRequest {headers: Object, onreadystatechange: null, readyState: 4, timeout: 15000, withCredentials: false…}headers: Objectonabort: nullonerror: (e)onload: ()onloadend: nullonloadstart: nullonprogress: nullonreadystatechange: nullontimeout: ()open: (type, url, async, user, password)overrideMimeType: (type)readyState: 4response: "{"error":{"code":500,"message":"Unable to complete operation.","details":["No edits ('adds', 'updates' or 'deletes') were specified."]}}"responseText: "{"error":{"code":500,"message":"Unable to complete operation.","details":["No edits ('adds', 'updates' or 'deletes') were specified."]}}"responseType: ""responseURL: "https://gisweb.tauranga.govt.nz/arcgis/rest/services/TreeApp/TreeCapture_AllMaintainenceAreas/FeatureServer/1/applyEdits"responseXML: nullsetRequestHeader: (name, value)status: 200statusText: "OK"timeout: 15000upload: XMLHttpRequestUploadwithCredentials: falseproto: XMLHttpRequestreq.onload @ /Scripts/esri/offline-edit-src.js:2186 /Scripts/esri/offline-edit-src.js:1782 OfflineFeaturesManager._replayStoredEdits - ERROR!!
1) What action caused this error? Is there any way to reproduce it?
2) The error refers to a file named offline-edit-src.js at line 2537
. There isn't a file with that name in this repo. Is this a custom file that you created?
3) What version and which library(s) from this repo are you using?
4) Please provide a complete copy of both the entire HTTP REQUEST HEADER and the HTTP RESPONSE. You can get this info from Chrome Developer tools in the Network tab or by using a debug proxy such as Charles, Fiddler or WireShark. A 500 error is an error in the server logic and may have nothing to do with the client app.
Here's an example of what I need:
REQUEST HEADER
HTTP RESPONSE
{"addResults":[],"updateResults":[{"objectId":20762,"globalId":null,"success":true}],"deleteResults":[]}
Dang, it appears the previous dev has made his own Angular version of your offline-edit script. Our bad, sorry. I'll take a look at your change, and see if i can inject it. :/
Ah, oops. I'll disregard unless you find something specific to the main library.
When online, edits are applied normally, however in offline mode, if an attribute has an "&" symbol in the data, the JSON breaks before it hits the server.