Select present and future dates only | Community
Skip to main content
September 10, 2020
Solved

Select present and future dates only

  • September 10, 2020
  • 3 replies
  • 5310 views

Hello, I wanted to ask if there is a way to have someone only be able to select a date that is today or a later date but not past dates. Is this possible? Thank you in advance.

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 santhosh_kumark

Hi @grodlegacy ,

 

If your requirement is to restrict the author to not select a past date then it could be achieved with the minDate property with value as "today". Or you can achieve it using Jquery:

$(function() {
$( "#datepicker" ).datepicker({ minDate: 0});
});

 

Regards,

SK

3 replies

Mayank_Gandhi
Adobe Employee
Adobe Employee
September 10, 2020

@grodlegacy  What kind of form are you developing? Is it PDF or Adaptive form.

Mayank_Gandhi
Adobe Employee
Adobe Employee
September 11, 2020
@grodlegacy Send me your email in pvt message I will mail you the sample.
Mayank_Gandhi
Adobe Employee
Adobe Employee
September 11, 2020

 

@grodlegacy  Use this on date picker:

 

 

var utc = new Date().toJSON().slice(0,10);
if(this.value<utc){

alert("do not select previous dates");
this.value=null;
guideBridge.setFocus(this);
}

santhosh_kumark
santhosh_kumarkAccepted solution
September 11, 2020

Hi @grodlegacy ,

 

If your requirement is to restrict the author to not select a past date then it could be achieved with the minDate property with value as "today". Or you can achieve it using Jquery:

$(function() {
$( "#datepicker" ).datepicker({ minDate: 0});
});

 

Regards,

SK

September 17, 2020
@santhosh_kumark How about using JavaScript? AEM Designer uses JS.