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
MarceldeBMarceldeB 

disable date picker in date field?

Hi, I have an inputfield 'day of birth' in my vf page. since the datepicker doesn't work here (only works fine for years ahaid or a few years in the past) and therefore is confusing, I would like to switch it off.

Any tricks how to do that?

Pradeep_NavatarPradeep_Navatar

Do you want to disable date picker in the date field and date section? Try out the sample code given below :

 

        <style> // for disable date picker

        .datePicker, .datePicker .dateBar ,.datePicker .calBody, .datePicker .calDays, .datePicker .buttonBar, .datePicker Select

        {

           display:none;

          }

        </style>

        .dateformat{ display:none;} // for disable date section

 

Did this answer your question? if so, please mark it solved.

MarceldeBMarceldeB

Thanks for your help.

looks great, but I can't get it to work. probably my poor jacascript knowledge.

 

I tried putting the coding you gave directly into the page as well as an inline style:

 

<apex:inputfield value="{!employee.DOB__c}" required="true" style=".datePicker, .datePicker .dateBar ,.datePicker .calBody, .datePicker .calDays, .datePicker .buttonBar, .datePicker Select { display:none;}" /> 

but nothing happens...

 

 

 

 

Pradeep_NavatarPradeep_Navatar

There is no need to provide date picker style in inputfield style attribute. So remove that style from inputfield and declare

style after <apex:page> .

 

Hope this helps.

MarceldeBMarceldeB

I'm not sure I understand.

 

I put the coding you gave in the page after <apex:page> as below (after original try I have now put the .dateformat line within the style block), but nothing happens on my page: the datepickers in all inputfields still remain.

 

 

<apex:page standardController="Medewerker__c" extensions="MedewArbrelExt">   
  <style> // for disable date picker
    .datePicker, .datePicker .dateBar ,.datePicker .calBody, .datePicker .calDays, .datePicker .buttonBar, .datePicker Select
    {
     display:none;
    }
    .dateformat{ display:none;} // for disable date section
  </style>
 
  <apex:form >
    <apex:pageBlock >
        <apex:inputfield value="{!Medewerker__c.Geboortedatum__c}" required="true" />
    </apex:pageBlock>
  </apex:form>
</apex:page>
 

 Can you see where I am going wrong? By the way, I would expect I have to swith the datepicker etc. off for a specific date-inputfield. In fact I do want the date-picker to be shown with some other date-fields.

 

 

 

 

MarceldeBMarceldeB

Hi, we seemed to be so near a solution... any idea how to solve this?