You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure exactly how to use a "customValidation", I defined the function (along with a console.log statement to ensure it was arriving into the function), and then passed in into the form, but I dont seem to be calling the function as expected?
function validate(field) {
console.log('validating',field);
let error = false;
let errorMsg = '';
if (field.name === 'username' && !(field.value && field.value.trim())) {
error = true;
errorMsg = 'Username is required';
}
if (field.name === 'password' && !(field.value && field.value.trim())) {
error = true;
errorMsg = 'Password is required';
}
return { error, errorMsg };
}
I am not sure exactly how to use a "customValidation", I defined the function (along with a console.log statement to ensure it was arriving into the function), and then passed in into the form, but I dont seem to be calling the function as expected?
The text was updated successfully, but these errors were encountered: