Frappe Cloud Support Partners Foundation Frappe School

Mobile Number Length Validation in ErpNext

Use this code in Java script file
frappe.ui.form.on(‘Customer Login’, {
mobile_no: function(frm) {
if (frm.doc.mobile_no){{
method: “validate_mob_number”,
callback: function® {

"Next step is to add the codes return below in your Python file"

def validate_mob_number(self):
if len(self.mobile_no) < 10:
frappe.msgprint(“Mobile number is invalid”)

frappe.ui.form.on(‘Customer_Login’, ‘validate’, function(frm) {
if (frm.doc.mobile_no.length<10) {
msgprint(‘The Mobile Number is invalid’);
Validate = false;

Try it