Client script in webform not working

hi all,

I created a doctype and add into webform in webform custom script I write date validation as follow:
let data = frappe.web_form.get_values();
frappe.web_form.validate = () => {
if (data.from_date < get_today()) {
frappe.msgprint(__(“You can not select past date in From Date”));
frappe.validated = false;
}
};

It not validate any this or else it shows error for any date selection.
I am completely working on cloud I am not using Ubuntu
please help me with this.

Thank you!

frappe.validated may not be the right way.

Docs:
https://frappeframework.com/docs/v14/user/en/guides/portal-development/web-forms#reset-value-if-invalid

Also, it suggests you can try this instead.
return false;

2 Likes