Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I recently posted this question on the Esri forums and thought I'd give stack exchange a try too.

I'd like to take this sample: http://help.arcgis.com/en/webapi/javascript/arcgis/demos/ed/ed_multipleAttrInspector.html

and change the text boxes to text areas similar to the "Editor with Toolbar (Union)" sample.

You can find these samples by going to: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm

The one I am trying to customize is listed under Editing - Edit Modifiable Fields One of the samples that uses text areas instead of text boxes is under Editing - Editor with Toolbar (Union)

Any help would be greatly appreciated. If you find a line of code that you think I need to add, please tell me exactly where it needs to be added in the "Edit Modifiable Fields" sample.

share|improve this question
    
Note: Seem these examples don't work fully with FireFox 4 (missing elements). IE9/10 okay. –  Mapperz May 25 '11 at 16:12

1 Answer 1

Create a custom fieldInfos array. In the first sample, modify the initEditing function. The code would look something like this to make the field named "notes" into a textarea:

dojo.forEach(layers, function(layer) {
  dojo.connect(layer, "onClick", function(evt) {
    if (map.infoWindow.isShowing) {
      map.infoWindow.hide();
    }

    var fieldInfos = dojo.map(layer.fields, function(field) {
      if (field.name === 'notes') {
        return { 'fieldName': field.name, 'label': field.alias, 'stringFieldOption': 'textarea' };
      } else {
        return { 'fieldName': field.name, 'label': field.alias };
      }
    });

    var layerInfos = [{
      'featureLayer': layer,
      'isEditable': false,
      'fieldInfos': fieldInfos
    }]

    var attInspector = new esri.dijit.AttributeInspector({
      layerInfos: layerInfos
    }, dojo.create("div"));


    query.objectIds = [evt.graphic.attributes.objectid];
    layer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function(features) {
      map.infoWindow.setContent(attInspector.domNode);
      map.infoWindow.resize(310, 165);
      map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
    });
  });
});
share|improve this answer
    
Thank you Derek! This worked and so did the few lines of code that Heming Zhu submitted on the Esri User Forums: forums.arcgis.com/threads/… You can see a more detailed account of my thanks there... the info window for new points as they are being created does not appear as a text area, but at this point I'm ready to leave well enough along! –  Indy May 25 '11 at 20:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.