diff --git a/modules/banche/add.php b/modules/banche/add.php index b613f7346..68f73414f 100755 --- a/modules/banche/add.php +++ b/modules/banche/add.php @@ -107,32 +107,35 @@ echo ' } function scomponiIban() { - $.ajax({ - url: globals.rootdir + '/actions.php', - data: { - id_module: globals.id_module, - op: "decompose", - iban: iban.get(), - }, - type: 'GET', - dataType: "json", - success: function (response) { - compilaCampi(response); + let value = iban.get(); + if (value.length > 25) { + $.ajax({ + url: globals.rootdir + '/actions.php', + data: { + id_module: globals.id_module, + op: "decompose", + iban: iban.get(), + }, + type: 'GET', + dataType: "json", + success: function (response) { + compilaCampi(response); - if (response.id_nazione.iso2 === "IT"){ - bic.setRequired(false); - var label_text = $('label[for=bic] span .text-red').text(); - $('label[for=bic] span .text-red').text(label_text.replace('*', ' ')); - } else { - bic.setRequired(true); - var label_text = $('label[for=bic] span .text-red').text(); - $('label[for=bic] span .text-red').text(label_text.replace(' ', '*')); + if (response.id_nazione.iso2 === "IT"){ + bic.setRequired(false); + var label_text = $('label[for=bic] span .text-red').text(); + $('label[for=bic] span .text-red').text(label_text.replace('*', ' ')); + } else { + bic.setRequired(true); + var label_text = $('label[for=bic] span .text-red').text(); + $('label[for=bic] span .text-red').text(label_text.replace(' ', '*')); + } + }, + error: function() { + toastr["error"](""); } - }, - error: function() { - toastr["error"](""); - } - }); + }); + } } function componiIban() {