-
Notifications
You must be signed in to change notification settings - Fork 45
Custom Validation
Vijaivir Dhaliwal edited this page Mar 28, 2024
·
8 revisions
This documentation is no longer being updated. For the most up to date information please visit our techdocs
Home > CHEFS Components > Custom Components > Custom Validation
Let's cover the custom validation for Day component
When the editor opens, navigate to tab Validation
and scroll down to open the section named Custom Validation
. Inside the Javascript section you need to write
var val = moment(input, 'MM/DD/YYYY');
valid = true;
if (!val.isValid() || val.format('YYYY') === '0000') {
valid = 'Please, enter the valid date';
}
This way we validate if user enter incorrect Day
for example e2, -2, +2
or leaves Year
box empty