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
Kirill YunussovKirill Yunussov 

InputField datepicker - want the calendar pop-up, but don't want today's date

Hi,

 

I have an inputfield on the page, for a Date field.   I want the popup with the calendar, but don't want today's date next to the field.   How do I do that?  Thanks.

 

<apex:inputField value="{!object.my_date_field__c}"/>

 

screenshot:  http://postimg.org/image/riaufvzfp/

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Avidev9Avidev9

You can do a bit off css trick

 

<style>
.dateFormat{display:none}
</style>

<apex:inputField value="{!object.my_date_field__c}"/>

 

All Answers

Subramani_SFDCSubramani_SFDC
use <Apex:inputtext>

Visualforce 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;}
}
Avidev9Avidev9

You can do a bit off css trick

 

<style>
.dateFormat{display:none}
</style>

<apex:inputField value="{!object.my_date_field__c}"/>

 

This was selected as the best answer
Kirill YunussovKirill Yunussov

Superb, thank you both.

Harshit Agrawal 4Harshit Agrawal 4

The below code doesn't works for Date Picker Calendar Popup. I have tried in both the desktop and mobile version. Do we have any alternative?


Visualforce page:

<apex:page controller="datePicker">
<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;}
}