This is one of the feature that was delivered "Winter 11" but looks like there are some limitation. The suggested feature seems to work only for the very first time when VF page loads but when a rerender is done and the underlying object is re-initialised it doesn't seem to pull the default value.
Code to replicate the same
<apex:page docType="html-5.0" standardcontroller="Account" extensions="TestPage_Con">
<apex:form >
<apex:pageBlock >
<apex:commandButton value="reset" action="{!reset}"/>
<apex:pageBlockSection >
<apex:inputField value="{!myAccount.MyField_With_Default_value__C}" required="false"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class TestPage_Con {
public Account myAccount{get;set;}
public TestPage_Con(ApexPages.StandardController controller) {
myAccount = new Account();
}
public void reset(){
myAccount = new Account();
}
}
Assumption
- MyField_With_Default_value__C is a field with a default value defined in field definition (Not controller)
Observation : The value loads for the first time but if you press the reset button the field clears out.
I am trying to avoid any value being assigned from controller or using field describe rather want to use the feature delivered in winter 11. Is am doing anything wrong here ?