Use this code in Java script file
frappe.ui.form.on(‘Customer Login’, {
mobile_no: function(frm) {
if (frm.doc.mobile_no){
frappe.call({
method: “validate_mob_number”,
doc:frm.doc,
callback: function(r) {
}
});
}
}
});
“Next step is to add the codes return below in your Python file”
@frappe.whitelist()
def validate_mob_number(self):
if len(self.mobile_no) < 10:
frappe.msgprint(“Mobile number is invalid”)