Is there an event that I can use for when the user moves from one field to another in the attribute inspector? How would I reference a particular control in the attribute inspector?
Depending on what you want to do there are a number of avenues.
If you just want highlight effects you can look into adding some :hover rules to various components inside AttributeInspectors.
.esriAttributeInspector input:hover{ background-color: yellow; }
If to do something on field changes then you just need the attribute-change event:
AttributeInspector | API Reference | ArcGIS API for JavaScript
If you want do something else you might need to dig a bit. I haven't tried this but it's an approach I would consider:
require(["dojo/_base/array", "dojo/on", "dijit/registry", "esri/dijit/AttributeInspector"], function(arrayUtil, on, registry, AttributeInspector){ // ... var attInspector = new AttributeInspector({ layerInfos: layerInfos }, domConstruct.create("div")); // get all registered dijits in the attributeInspector var formWidgets = registry.findWidgets(attInspector.domNode); // For each widget arrayUtil.forEach(formWidgets , function(w){ w.on("focus", someFunction); }); });
Agreed that you'll need to be creative, there is no field-change event in the Attribute Inspector. Another idea is listening for when the focus of a field changes using 'dijit/focus', dijit/focus — The Dojo Toolkit - Reference Guide..
Depending on what you are trying to do you should be able to use the field's id (indexed numerically if you look at the field in the DOM) to access different nodes.
Thank you for the very useful input. I used the onAttributeChange event in combination with known field names in order to isolate specific changes.I am sure that I will use both of your suggestions.
dojo.connect(theAttributeInspector, "onAttributeChange", function (feature, fieldName, newFieldValue) | |
{ | |
if ((fieldName == "SPECIESFAILPOTENTIAL")) | |
{ | |
Execute desired code .... | |
} | |
}); |