You need to sign in to do that
Don't have an account?
Joe Salesvue
Visualforce Issue with Default Values on Input Fields after Rerender
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"/>
</apex:form>
</apex:page>
public class testoppextension {
public boolean show {get;set;}
public testoppextension(ApexPages.StandardController std){
show = false;
}
public void refresh(){
show = true;
}
}
<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"/>
</apex:form>
</apex:page>
public class testoppextension {
public boolean show {get;set;}
public testoppextension(ApexPages.StandardController std){
show = false;
}
public void refresh(){
show = true;
}
}
I think you may be concerned by that http://salesforce.stackexchange.com/questions/23458/default-values-in-visualforce-input-fields.
Hope this helps,
Fred
All Answers
I think you may be concerned by that http://salesforce.stackexchange.com/questions/23458/default-values-in-visualforce-input-fields.
Hope this helps,
Fred
Did this answer helped you? If so, feel free to mark the question as Solved and kindly select the best answer of your choice!
Thanks,
Fred