Select to view content in your preferred language

update attributes without attributeInspector

578
1
11-19-2010 11:52 AM
KathleenBrenkert
Regular Contributor
I've tried a couple different ways but so far this bit of code seems to have me the closest.  I've got a form that is populated with the attributes of my selected feature.  I can make my changes to the attributes in the form and then I have a submit button (see code).

If I run the debugger 'feature' has the objectID of my selected feature and the updated attributes from the form, in an array.  When I run it I get error 1009, cannot access a property or mehtod of a null object reference

protected function submitChanges_clickHandler(event:MouseEvent):void
   {
    var feature:Graphic=myFeatureLayer.selectedFeatures[0];
    feature.attributes={OBJECTID:myFeatureLayer.selectedFeatures[0].attributes.OBJECTID,GROUP_TYPE:proType.text,NAME:proName.text, DESCRIPT:proDescript.text};
    const updates:Array=[feature];
    myFeatureLayer.applyEdits(null,updates,null);
    myFeatureLayer.addEventListener(FeatureLayerEvent.EDITS_COMPLETE, myFeature_editsCompleteHandler);
   }

Tags (2)
0 Kudos
1 Reply
KathleenBrenkert
Regular Contributor
I just realized my code is working-I'm almost sorry I posted.  It's my event listener that fails.  What am I not passing to the event listener that causes the error message?
0 Kudos