[GIS] How to change a text box to a text area? (ArcGIS API for JavaScript)

arcgis-javascript-apiarcgis-server

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.

Best Answer

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));
    });
  });
});