SnackBar related

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?

@Aswin @Eldho @Sam @Simphiwe

Hi @mohammedrimshan,

You want to show a dynamic message on your snackbar that will depend on the validations ??

so is possible to map that errors to local like bh.local.errors

@mohammedrimshan,

You can drag and drop the snackbar node and set the message dynamic or static.
I have attached the snackbar documentation link below.

Snackbar Node

1 Like