function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

data picker on VF custom page

I have requirments need to create new custom VF page with only controller no standaradController.

problem is i have to display data picker for start date and end date fields.

so i have used <apex:input type="date"   it is not working in IE, Mozilla browers
if use <apex:inputText value="{!caseStartDate}" size="10" id="caseStartDate" label="Start Date" onchange="caseDateValidates()" onclick="DatePicker.pickDate(false, this , false);" />    
 here onchange not working...

any other way to get date picker on VF page and pass the date values to controller based on onchange event ....


You can use <apex:inputField> and bind it with the date field type.

<apex:inputField value="{!acc.Date__c}"/>
SandhyaSandhya (Salesforce Developers) 
Hi Royal,

I'd suggest if the page is not that complex, declare a dummy object which has a Date type field and bind it with the page.
public class Unavailable_Dates_Controller 
    public objWithDateField objForStartDate{get;set;}
    public objWithDateField objForEndDate{get;set;}

    public Unavailable_Dates_Controller(){
        objForStartDate = new objWithDateField();
        objForEndDate = new objWithDateField();
<apex:pageBlockSection > <apex:inputField value="{!objForStartDate.date_field__c}" label="Start Date"/> <apex:inputField value="{!objForEndDate.date_field__c}" label="End Date"/> </apex:pageBlockSection>

And also you can try onfocus instead of onclick.

Please accept my solution as Best Answer if my answer was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
Thanks and Regards