-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
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 };
}
<GenerateForm
ref={(c) => {
this.formGenerator = c;
}}
fields={fields}
customValidation={validate}
/>
Metadata
Metadata
Assignees
Labels
No labels