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
reshmareshma 

How to Display a calender in salesforce

Hi can anyone give me suggestion as to how to display a calendar input filed in salesforce.
Without referrinfg to any object.
 
dchasmandchasman
The best way to accomplish this today is to use <apex:inputField> bound to a date field on an sobject that you create just for this purpose - using an sobject as just another data structure or built in type.

For example, in your controller or controller extension you'll have something like this:

Code:
public Contact getDateProxy() {
  return dateProxy;
}

private final Contact dateProxy = new Contact();

and then you use this from your page like this

Code:
<apex:inputField value="{!dateProxy.birthDate}"/>

 

reshmareshma
Thanks for the response.
 
I did in this way it is working fine
 
In the controller
 
Task t = new Task();
Date d = t.activitydate;   
 public Task getTask() { return t; }
 
In apex page
<apex:inputField name='journeydate' value="{!task.activityDate}"/>
ASMASM
Hi, I would like to know if I could use a custom field for Calender/Date in opportunities and have the dates populated automatically into a Calender. And this Calender should be viewed by all the users of the system.