• Joe Salesvue
  • 10 Points
  • Member since 2014

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0
There appears to be a bug in Visualforce where inputField defaults do not display if the field is initially hidden and then a rerender displays the field.  If the field is initially visible then the default value is displayed on page load and after a rerender.  I have tested this on the latest API (32.0) and have a simple page example below that can be used to try to reproduce the issue.  In the code example below, the TrackingNumber__c field on opportunity has a default formula value of $User.LastName.  When you click the refresh button it will set a boolean flag (show) which will cause the inputfield to be displayed after the rerender completes.  If you remove the rendered attribute hiding the inputfield you will notice that the field default does display correctly even if you hit the refresh button.

<apex:page standardcontroller="opportunity" extensions="testoppextension">
    <apex:form id="frm">

        <apex:inputField value="{!opportunity.TrackingNumber__c}" rendered="{!show}"/>
        <apex:commandButton value="refresh" action="{!refresh}" rerender="frm"/>

public class testoppextension {

    public boolean show {get;set;}
    public testoppextension(ApexPages.StandardController std){
        show = false;
    public void refresh(){
        show = true;