You need to sign in to do that
Don't have an account?
Gil Hecht
Populate an InputField with a Default Value?
Hi below is my code for a visualforce page. I'm wondering if in the last_dial__c field I can autopopulated it with today's date as a default value. Thanks!
<apex:page standardController="Lead" recordSetVar="leads" tabStyle="Lead" extensions="tenPageSizeExt"> <apex:form > <apex:pageBlock title="Log a Call" mode="edit"> <apex:pageMessages /> <apex:pageBlockButtons location="top"> <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!selected}" var="leadselect"> <apex:column headerValue="Lead Name"> <apex:inputField value="{!leadselect.name}"/> </apex:column> <apex:column headerValue="Number of Dials"> <apex:inputField value="{!leadselect.Calls_Made_Counter__c}"/> </apex:column> <apex:column headerValue="Last Dialed"> <apex:inputField value="{!leadselect.Last_Dial__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
In the constructor of your extension class, you can set the default value like below.
leadselect.Last_Dial__c = system.today();
Regards,
Krishna.