Can't show error message
I have a validate:
$("div[name='birthday-form']").addClass("validate[required], custom[checkbirth], custom[checkbirthyear], custom[checkbirthmonth], custom[checkbirthday]");
But I don't want to display the 'required' error anymore, so I changed the validation to $("div[name='birthday-form']").addClass("validate[custom[checkbirth], custom[checkbirthyear], custom[checkbirthmonth], custom[checkbirthday]]"); but now it doesn't show the error message. Do you know why?
I have the same problem, so I used another approach: funcCallRequired.
validate[funcCallRequired[checkbirthyear]]
For the function, when it's correct, it needs to return undefined. I'm not sure if this is the best way to do it, but it works for me.
function checkbirthyear() {
const birthyear = $("#" + "birthyear").val();
let msg = isValidYear(birthyear);
if (msg) {
return msg;
} else {
// This is needed to prevent the error message from showing when it's correct.
return undefined;
}
}