Field’s default value is ignored in postback requests

VisualForce

Last updated 2016-07-28 ·Reference W-1299879 ·Reported By 16 users

No Fix

Summary
Field’s default value is ignored in postback requests, even though it is first time to be rendered

Repro
1. Create picklist field ‘picklist1’ in Account object, set one picklist value as default.

2. Create VF component:
<apex:page standardController="Account" extensions="ajaxpopupExt">
<apex:form >
<apex:commandButton value="Load Panel" action="{!showPopup}" rerender="panel"/>
<apex:outputPanel id="panel">
<apex:inputField value="{!account.picklist1__c}" rendered="{!displayPopup}"/>
</apex:outputPanel>
</apex:form>
</apex:page>

3. Create Apex Class:
public class ajaxpopupExt {
public boolean displayPopup {get; set;}

public ajaxpopupExt(ApexPages.StandardController controller) {
displayPopup = false;
}

public void showPopup() {
displayPopup = true;
}
}

4. On the rendered page, click button ‘Load Panel’. Notice the picklist that appears has value ‘-None-’ instead of default value.

Workaround
n/a

Is it Fixed?

AP0 AP1 AP2 AP3 AP4 AP5 CS1 CS2 CS3 CS4 CS5 CS6 CS7 CS8 CS9 CS10 CS11 CS12 CS13 CS14 CS15 CS16 CS17 CS18 CS19 CS20 CS21 CS22 CS23 CS24 CS25 CS26 CS27 CS28 CS30 CS31 CS32 CS33 CS40 CS41 CS42 CS43 CS44 CS45 CS50 CS51 CS52 CS53 CS54 CS57 CS58 CS59 CS60 CS61 CS62 CS63 CS64 CS65 CS66 CS67 CS70 CS71 CS80 CS81 CS82 CS83 CS84 CS85 CS86 CS87 CS88 CS89 EU0 EU1 EU2 EU3 EU4 EU5 EU6 EU7 EU9 EU11 NA2 NA3 NA4 NA5 NA6 NA7 NA8 NA13 NA14 NA15 NA16 NA17 NA18 NA19 NA20 NA21 NA22 NA23 NA24 NA25 NA26 NA27 NA28 NA29 NA30 NA31 NA32 NA33 NA34 NA35 NA37 NA38 NA39 NA40 NA41 NA42 NA43 NA44 NA45 NA46 NA47 NA48 NA49 NA49_ NA50 NA51 NA52 NA54 NA55 NA56 NA566 NA57 NA58 NA63 NA74 NA74_ NA78 NA88

Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.