hey gurus,
I have an issue, where I have to select only current and future date.
Lets say I have an input Date/Time field. date pattern is date{DD.MM.YYYY}. This is an input field. I want to make sure this Date Picker on the form should be for Today's and Future date. Not for past date. For past dates, date picker should either be greyed out or non editable. Basically user should not be able to select past date from date picker. How do I do it? Pls refer below ss
Views
Replies
Total Likes
Hi @fastdo ,
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});
});
Views
Replies
Total Likes
how do I set minDate property with value as "today". Is this configuration?
Views
Replies
Total Likes
I am using ADOBE livecycle designer for SAP developers. so I am not able to find "minDate property with value as "today" " functionality.
Views
Replies
Total Likes
You can try something like this as 'Validate' script of date field:
if (event.value) {
var currentDate = new Date();
// Adjust current date to start of day for accurate comparison
currentDate.setHours(0, 0, 0, 0);
// Use util.scand to convert the entered date string to a Date object
// The format "mm/dd/yyyy" should match your field's display pattern
var enteredDate = util.scand("mm/dd/yyyy", event.value);
if (enteredDate < currentDate) {
app.alert("Please enter a current or future date.");
event.value = ""; // Clear the invalid entry
// You may need to also set focus back to the field if desired
}
}
If the user doesn't enter a current or future date, it will pop alert and clear the field.
Views
Replies
Total Likes
Views
Likes
Replies