lcFormValidation
lcFormValidation copied to clipboard
Update readme
In the Validating the entire form example the viewModel is { login, password } and it should be { firstName, lastName }
const viewModel = { login: '[email protected]', password: 'jdoe3981' };
customerFormValidation
.validateForm(viewModel)
.then((validationResult) => {
console.log(validationResult.success); // true
console.log(validationResult.formGlobalErrors); // []
console.log(validationResult.fieldErrors);
/*{
firstName: { succeeded: true, type: "REQUIRED", key: "firstName", errorMessage: "" },
lastName: { succeeded: true, type: "REQUIRED", key: "lastName", errorMessage: "" }
}*/
})
.catch((error) => {
// handle unexpected errors
});