How to disable datepicker textfield? | Community
Skip to main content
Adobe Employee
April 29, 2022
Solved

How to disable datepicker textfield?

  • April 29, 2022
  • 1 reply
  • 6372 views

Hi,

 

I'm using datepicker in my component and I have given minDate as today in properties which works fine by disabling the previous days. How to disable the textfield so that author won't be enter the date but only pick the date from datepicker.

 

Thank you 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi,

You may have to write a custom logic to disable keyborad input to input text field

https://stackoverflow.com/questions/29715655/html-5-input-type-date-disable-keyboard-input

 

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
April 29, 2022

Hi,

You may have to write a custom logic to disable keyborad input to input text field

https://stackoverflow.com/questions/29715655/html-5-input-type-date-disable-keyboard-input

 

Arun Patidar
October 4, 2023
$("#birthdate").datepicker({
        dateFormat: 'dd-mm-yyyy',
        maxDate: new Date()
    });
 
How can i disable this date picker from users manually typing
arunpatidar
Community Advisor
Community Advisor
October 4, 2023

If you are using the Coral datepicker then you can use readonly flag.

https://developer.adobe.com/experience-manager/reference-materials/6-5/coral-ui/coralui3/Coral.Datepicker.html 

var datepicker = new Coral.Datepicker().set({
placeholder: "Choose a date",
name: "field",
value: "2015-01-15",
valueFormat: "YYYY-MM-DD",
displayFormat: "YYYY-MM-DD",
startDay: "0",
readOnly: true
});

Arun Patidar