applyEdits on a polyline FeatureLayer is throwing the error message "Invalid or missing input parameters". The relevant code is given below for reference:
function requestCreateFeature() {
//loop through the items and add to the feature layer
var feature = [];
var attr = {};
var d = new Date();
var geometry;
if (featType =="point") {
var myx = pxmin.value; // value from a user input texbox
var myy = pymin.value; // value from a user input textbox
geometry = new Point(myx,myy,map.spatialReference);
} else {
var myxmin = lxmin.value; // values from a user inputtexbox
var myymin = lymin.value; // value from a user inputtexbox
var myxmax = lxmax.value; // value from a user input texbox
var myymax = lymax.value; // value from a user input texbox
geometry = new Polyline ([[myxmin, myymin],[myxmax, myymax]]);
}
attr["sapname"] = pname; // value from a user input texbox
attr["creation_date"] = d.toUTCString();
attr["status"] = 1;
var graphic = new Graphic(geometry);
graphic.setAttributes(attr);
feature.push(graphic);
myFeature.applyEdits(feature, null, null, onsucess, onerror);
}
function onsucess(evt) {
alert("Edit successful...");
}
function onerror(evt){
alert("There is some error in creation...");
}
Instead of creating the feature array like this
var feature = [];
apply that in the applyEdits function.
The following works for me (feature service has to be changed):
var myFeature= new FeatureLayer("http://services.arcgis.com/feww435rERdff45/ArcGIS/rest/services/featureName/FeatureServer/0", {
mode: FeatureLayer.SELECTION_NEW
});
var feature = {};
feature["attributes"] = {};
feature["attributes"].DATE = new Date().toString();
feature["geometry"] = geometry;
myFeature.applyEdits([feature], null, null, onsucess, onerror);