I have the same question. The link posted above is not helpful at all. How is it possible to override this default behavior with the attribute inspector?
I don't think it's reasonable to expect users to click 41 times from 1970 to 2011 just to set a date.
dojo.connect(pointsOfInterest,"onBeforeApplyEdits",function(adds,updates,deletes){ //update the date field for new features to be today's date. dojo.forEach(adds,function(add){ add.attributes.notedate = new Date().getTime(); }); });
The attribute inspector date calendar displays the date stored in the feature's date field. New fields don't have a value so the default date of January 1, 1970 is displayed. You can modify this by setting the date's value to the current date (or whatever value you'd like) when a new feature is created. To do this listen for the feature layer's 'onBeforeApplyEdits' event and update the date for the newly added feature(s). In the sample below 'pointsOfInterest' is the feature layer whose date field you want to update.dojo.connect(pointsOfInterest,"onBeforeApplyEdits",function(adds,updates,deletes){ //update the date field for new features to be today's date. dojo.forEach(adds,function(add){ add.attributes.notedate = new Date().getTime(); }); });
Thank you Renee, I'd like to echo your comments. The date field worked just fine at 2.2, this is definitely a backwards step at 2.3. If anyone has a code solution for this I'd be grateful to see it, but in the meantime we're sticking with 2.2 for our editing APIs.
Thanks,
Mark.