bh.local.formdata=bh.input.form.value
const data = bh.input.form.value;
function validateBook(data) {
const errors = ;
if (!data.isbn || data.isbn.trim().length < 4) {
errors.push("ISBN must be at least 10 characters long");
}
if (!data.title || data.title.trim().length < 2) {
errors.push("Title is required and must be at least 2 characters");
}
if (!data.publishedYear || !/^\d{4}$/.test(data.publishedYear)) {
errors.push("Published Year must be a valid 4-digit number");
}
return errors;
}
const errors = validateBook(data);
console.log(errors,“FFF”)
if (errors.length > 0) {
throw new Error(errors.join(", ")) ;
}
Is it possible to show this validation in the snackbar node?