AnsweredAssumed Answered

help code

Question asked by hchapa89 on May 21, 2014
Latest reply on May 27, 2014 by hchapa89
I am having trouble with this code I am trying to auto populate a field from this feature class.
This is what I have so far and is not working.
my events.on('update-end', function is not working.

could someone check it out and tell me what is wrong.

Do I have to use attribute inspector instead if so How do I apply it to this code.

Thanks,


[HTML]
  var events = new FeatureLayer("http://maps.lrgvdc911.org:6080/arcgis/rest/services/Public_Outreach/EVENTS/FeatureServer/0",{
          mode: FeatureLayer.MODE_ONDEMAND,
           outFields: ['EVENT_NAME', 'date','address','city','estattendance','agegroup', 'psap']
        });
       
       events.on('update-end', function(evt){
          var feature = evt.feature;
          feature.attributes.psap = 'hello';
          feature.getLayer().applyEdits(null, [feature], null);
       });
     

        map.addLayers([events]);

        function initEditor(evt) {
          var templateLayers = arrayUtils.map(evt.layers, function(result){
            return result.layer;
          });
          var templatePicker = new TemplatePicker({
            featureLayers: templateLayers,
            grouping: true,
            rows: "auto",
            columns: 1
          }, "draggable");
          templatePicker.startup();
         
        
          
         
         

          var layers = arrayUtils.map(evt.layers, function(result) {
            return { featureLayer: result.layer,
            disableAttributeUpdate: false};
          });
          var settings = {
            map: map,
            templatePicker: templatePicker,
          
            layerInfos: layers,
            toolbarVisible: true,
            createOptions: {
              polylineDrawTools:[ Editor.CREATE_TOOL_FREEHAND_POLYLINE ],
              polygonDrawTools: [ Editor.CREATE_TOOL_FREEHAND_POLYGON,
                Editor.CREATE_TOOL_CIRCLE,
                Editor.CREATE_TOOL_TRIANGLE,
                Editor.CREATE_TOOL_RECTANGLE
              ]
            },
            toolbarOptions: {
              reshapeVisible: true
            }
          };
          
         
          var params = {settings: settings};   
          var myEditor = new Editor(params,'editorDiv');
          //define snapping options
          var symbol = new SimpleMarkerSymbol(
            SimpleMarkerSymbol.STYLE_CROSS,
            15,
            new SimpleLineSymbol(
              SimpleLineSymbol.STYLE_SOLID,
              new Color([255, 0, 0, 0.5]),
              5
            ),
            null
          );
          map.enableSnapping({
            snapPointSymbol: symbol,
            tolerance: 20,
            snapKey: keys.ALT
          });
       
       
          myEditor.startup();
         
         
         
        }[/HTML]

Outcomes