AEM Asset Metadata schema custom validation
HI Team,
I hope i am asking valid point.
As we know , We can create a custom Meataschema profile in AEM from below URL
My Question is
I would like create a custom validation for a form field instead of only Required field in Form in Metadata schema.
Example : i would like add Regex for entering text in Name field with chars limit.
I am trying as below, issue here is showing error but i am unable to stop saving the data, when i click on Save its not stopping
<script>
jQuery.validator.register({
selector: "[data-myapp-maxlength]",
validate: function(el) {
var maxlength = parseInt(el.attr("data-myapp-maxlength"), 10);
if (isNaN(maxlength)) {
return;
}
var length = el.val().length;
if (length > maxlength) {
return "The field needs to be maximum " + maxlength + " characters. It currently has a length of " + length + ".";
}
}
});
</script>

