Date Validation in Adaptive Forms

Here is a quick snippet that validates if a date entered by a user is greater than today’s date in AEM (Adobe Experience Manager) Adaptive Form.

var today = new Date();
var field = new Date(this.value);

console.log("today date value:" +today);
console.log("current field value:" +field);
if(field >= today)
{
console.log("This will fire validation since date is greater than today's date");
this.validate= false;
}
else{
console.log("This will not fire validation since date is less than today's date");

this.validate= true;
}

Be First to Comment

Leave a Reply

Your email address will not be published.