[SalesForce] Is it possible to display the default datepicker (calendar) on a VF page with Date field

I have a custom field which is called Date__c (It's a Date field type) and I want to display it on a custom VF page.

<label>Date:</label>
  <apex:inputText value="{!workLog.Date__c}" styleClass="date form-control"/>

The problem is that I get a text box and not a calendar as I expect to see.date

How can I make it show the calendar?

I searched all over this forum but with no success, I only found this post which suggested to use something like this:

<apex:input value="{!workLog.Date__c}" type="date" />

but it produced this error:

Error: <apex:input> does not support fields on a Salesforce object. 
Use <apex:inputField> for expression '{!workLog.Date__c}'

Please assist

Best Answer

Change your code to

<apex:inputfield value="{!workLog.Date__c}" styleClass="date form-control"/>
Related Topic