mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 20:29:09 +00:00
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
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
# Date Validation
|
# Date Validation
|
||||||
|
|
||||||
|
|
||||||
frappe.ui.form.on("Event", "validate", function(frm) {
|
frappe.ui.form.on("Task", "validate", function(frm) {
|
||||||
if (frm.doc.from_date < get_today()) {
|
if (frm.doc.from_date < get_today()) {
|
||||||
msgprint(__("You can not select past date in From Date"));
|
msgprint(__("You can not select past date in From Date"));
|
||||||
throw "past date selected"
|
validated = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user