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
Amrin.Amrin. 

How to add calendar on visualforce page?

Can anybody tell me how to add calendar on visualforce page... 

Best Answer chosen by Admin (Salesforce Developers) 
ashish raiashish rai

Hello,

Well when you use <apex:inputfield value="">. When you bind the value with field type of date/datetime it will automaticaly display calander on your VF page.Liket his:

 

<apex:page standardController="Account" >

 <apex:form> 

<apex:inputField value="{!account.AshishPackage__SLAExpirationDate__c}"/>

</apex:form>

</apex:page>

 

Here AshishPackage__SLAExpirationDate__c is a custom field insdie Account with type Date. Think this will help you to resolve your problem.

All Answers

ashish raiashish rai

Hello,

Well when you use <apex:inputfield value="">. When you bind the value with field type of date/datetime it will automaticaly display calander on your VF page.Liket his:

 

<apex:page standardController="Account" >

 <apex:form> 

<apex:inputField value="{!account.AshishPackage__SLAExpirationDate__c}"/>

</apex:form>

</apex:page>

 

Here AshishPackage__SLAExpirationDate__c is a custom field insdie Account with type Date. Think this will help you to resolve your problem.

This was selected as the best answer
PkSharmaPkSharma

Hi,

If you are using properties for bind then you can use something like this.

<apex:inputText onfocus="DatePicker.pickDate(false, 'thepage:theform:txtDate1', true);" id="txtDate1" value="{!strDate}" />

where strDate is property.

if you are using a field of object to bind then you can use

 <apex:inputField value="{!acc.WFFired__c}"/>

where WFFired__c is a field of account with datatype date/time and acc is a instance of account.

 

Hope this will help you...

Amrin.Amrin.

Thank you for helping..