I created my own Doctype called “Staff Policies and Procedures”. I wanted to validate a date field with the fieldname “date” to limit the user to not select future dates. So i copied the date validate code from the documentation, made the required changes but the script does not work and the form saves even if I select a future date. Here is my code
frappe.ui.form.on(“Staff Policies and Procedures”, “validate”, function(frm) {
if (frm.doc.date > get_today()) {
frappe.msgprint(__(“You can not select future date in From Date”));
frappe.validated = false;
}
});
Hi @Vesper_Solutions did you already define get_today() ??
Maybe try using frappe.datetime.get_today(), it’s build in function from Frappe to get today.
frappe.ui.form.on(“Staff Policies and Procedures”, “validate”, function(frm) {
if (frm.doc.date > frappe.datetime.get_today()) {
frappe.msgprint(__(“You can not select future date in From Date”));
frappe.validated = false;
}
});
frappe.ui.form.on(“Staff Policies and Procedures”, “validate”, function(frm) {
if (frm.doc.date > frappe.datetime.get_today()) {
frappe.msgprint(__(“You can not select future date in From Date”));
frappe.validated = false;
}
});
I have created sales order as an Accounting Dimension but while making a payment entry, the following error pops up when we click in the sales order feild on payment entry form. No solutions till now.