We want to set the length to exactly 10. For example, someone puts a 9-digit number or 11 it should not be allowed.
How to mange this.
We want to set the length to exactly 10. For example, someone puts a 9-digit number or 11 it should not be allowed.
How to mange this.
You can use this client script
frappe.ui.form.on('YourDoctype', {
validate: function(frm) {
var phone_field = frm.doc.phone
if (frm.doc[phone_field] && frm.doc[phone_field].length !== 10) {
frappe.msgprint(__("Phone number must be 10 digits long."));
frappe.validated = false;
}
}
});
Sorry it is not working- Misspelled in earlier statement