Dear Community,
I had one field name National ID,Mobile no in customer Doctype i set digit limit based on Client Script,but from Quick Entry the code not works so how to enable that.
error message need to come if ID exceed more than 12 digits
frappe.ui.form.on('Customer', {
validate: function (frm) {
var nationalID = frm.doc.custom_national_id_numbereid; // Replace with actual fieldname
var mobileNo = frm.doc.custom_mobile_no; // Replace with actual fieldname
// Validate National ID
if (nationalID && !/^\d{12}$/.test(nationalID)) {
frappe.msgprint(__('Please enter a correct National ID number.'));
frappe.validated = false;
}
// Validate Mobile No
if (mobileNo && !/^\d{11}$/.test(mobileNo)) {
frappe.msgprint(__('Please enter a correct Mobile No (11 digits).'));
frappe.validated = false;
}
}
});