I took me quite a long time figure out why my <defaultvalue> property of my custom field type was not taken into account. It turned out that I need to do a little bit of work in my overriding of the CreateChildControls of my field control.
Basically, we are checking the field has actually no value (to avoid overriding a previously set value) through base.ListItemFieldValue and also if a default value was provided in the field xml definition (or programmatically).
{
base.CreateChildControls(); if(ControlMode== SPControlMode.New || ControlMode == SPControlMode.Edit)
{
string currentValue = (base.ListItemFieldValue == null ? string.Empty : base.ListItemFieldValue.ToString());
if (string.IsNullOrEmpty(currentValue) && !string.IsNullOrEmpty(Field.DefaultValue))
{
base.ListItemFieldValue = Field.DefaultValue;
}
}
}
Sweet !