brotherton-erpnext/erpnext/docs/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/date-validation.md
sbkolate b17d4035c1 better validation example for developer
throw "past date selected" will freeze the form and user can not correct value of  from_date.
but validated false will just throw the pop-up and user can correct value of from_date and save the form.

Example changed from Event to Task because same is available in Custom Script Help for desk user
2016-02-22 17:16:34 +05:30

247 B

Date Validation

frappe.ui.form.on("Task", "validate", function(frm) {
    if (frm.doc.from_date < get_today()) {
        msgprint(__("You can not select past date in From Date"));
        validated = false;
    }
});

{next}