AnsweredAssumed Answered

Editor attribute inspector default values

Question asked by dhollema on Dec 12, 2011
Latest reply on Dec 16, 2011 by dhollema
I'm curious what some approaches are to providing default values for fields by means of the out-of-the-box attribute inspector.  Ideally, I'd like to display the value to the end user in an editable or non-editable text box.

I've tried 3 approaches.


  1. Intercept on layer's BeforeApplyEdits event and provide value based on advice here by Kelly Hutchins -> http://forums.arcgis.com/threads/32271-Default-date-of-1970-for-date-field-at-2.3?highlight=default+values

  2. Use customField based on my own custom dijit for fieldInfo - never successfully completed this.  I can see the value in the attribute inspector but it doesn't get transmitted across the wire to ArcGIS Server.

  3. Use customField based on my dijit.form.TextBox - never successfully completed this.  I can't see the value in the attribute inspector. I tried setting the 'value' of the textbox in the constructor and later using .set("value").


  4. My own custom dijit attempt is described here
    var userIDdijit = new nrss.overflights.dijit.SimpleBehavioralDijit({ "value": user }); //user variable has a value, I double-checked

    //and in fieldInfos
    { 'fieldName': 'USERID', 'label': 'User ID', 'customField': userIDdijit, 'isEditable':true}

    SampleBehavioralDijit

    dojo.provide("nrss.overflights.dijit.SimpleBehavioralDijit");
    dojo.require("dijit._Widget");


    //this class is used to provide default values for a field in the editor dijit
    dojo.declare("nrss.overflights.dijit.SimpleBehavioralDijit", [dijit._Widget], {

        // put methods, attributes, etc. here
        value: 'No content defined',
        _disabled: true,
        _execute: function () {
            if (typeof this.value === 'function') {
                return this.value();
            }
            else {
                return this.value;
            }
        },

        buildRendering: function () {
            // create the DOM for this widget    
            var textBox = new dijit.form.TextBox({ 'value': this._execute() });
            this.domNode = textBox.domNode;
        }
    });


The issue, I suspect, is in how the attribute inspector pulls the values from the form to send off to the post request.  Since I'm creating a new dom node, my guess is the attribute inspector doesn't see this value.  I prefer this custom dijit approach...can anyone offer assistance?

Outcomes