Activity Forums Salesforce® Discussions How to get standard date picker custom Visualforce in Salesforce?

  • Deepak

    Member
    December 10, 2019 at 2:40 pm

    Please find the below examples to display the date field with date pickers.

    Ex 1 :
    Visual Force Page :
    <apex:page docType="html-5.0" controller="Sample">
    <apex:form >
    <apex:pageBlock >
    <apex:pageBlockSection>
    <apex:pageBlockSectionItem>
    Date: <apex:input type="date" value="{!dat}"/>
    </apex:pageBlockSectionItem>
    </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:form>
    </apex:page>

    Apex Controller :
    public class Sample {
    public Date dat {get;set;}
    public Sample() {

    }
    }

    Ex 2 :
    Visual Force Page :
    <apex:page controller="datePicker" id="mypage">
    <apex:form>
    Date: <apex:inputText value="{!datename}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this , false);" />
    </apex:form>
    </apex:page>

    Apex Controller :
    public class DatePicker
    {
    public String datename {get; set;}
    }

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos