ionarawilson

Change the attribute value when the field has a domain?

Discussion created by ionarawilson on Nov 20, 2013
I am using the editor widget. I want to be able to assign some default values when the polygon is created. In the code below, the City values turns to Austin, when the polygon is created, but the Office value does not, probably because it has a domain (however the Austin value is part of the domain). When I digitize the polygon, the polygon disappears if I use the code that sets the default value for Office. Everything works great if I use the code to change the value of City. How can I set the default value in this case, when the field has a domain? thanks

     
        //add a default value for newly added features 
        dojo.connect(stewardship,'onBeforeApplyEdits',function(adds,deletes,updates){
          dojo.forEach(adds,function(add){
            if(add.attributes['DateStart'] === null){

      add.attributes.DateStart = new Date().getTime().toString();

            }
   
   if(add.attributes['City'] == null ){
    
    
             add.attributes.City = new String("Austin")
    add.attributes.Office = new String("Austin")
            }
          });
        });

Outcomes