1jQuery(function ($) { 2 const ANET_ECHECK_ACCOUNT_TYPE_CHECKING = anetEdit.account_types[0]; // 'checking'. 3 const ANET_ECHECK_ACCOUNT_TYPE_SAVINGS = anetEdit.account_types[1]; // 'savings'. 4 // Remove any maxlength attributes that might be limiting input. 5 $('#anet-echeck-edit-account-number').removeAttr('maxlength'); 6 $('#anet-echeck-edit-routing-number').removeAttr('maxlength'); 7 $('#anet-echeck-edit-name-on-account').removeAttr('maxlength'); 8 // Real-time input validation - Account Number (only digits). 9 $('#anet-echeck-edit-account-number').on('input', function (e) { 10 var $this = $(this); 11 var value = $this.val(); 12 // Remove any non-digit characters and limit length. 13 var cleanValue = value.replace(/\D/g, ''); // Remove all non-digits. 14 if (cleanValue.length > 17) { 15 cleanValue = cleanValue.substring(0, 17); // Limit to 17 digits. 16 } 17 // Update field if value changed. 18 if (cleanValue !== value) { 19 $this.val(cleanValue); 20 } 21 }); 22 // Real-time input validation - Routing Number (only digits, max 9). 23 $('#anet-echeck-edit-routing-number').on('input', function (e) { 24 var $this = $(this); 25 var value = $this.val(); 26 // Remove any non-digit characters and limit length. 27 var cleanValue = value.replace(/\D/g, ''); // Remove all non-digits. 28 if (cleanValue.length > 9) { 29 cleanValue = cleanValue.substring(0, 9); // Limit to 9 digits. 30 } 31 // Update field if value changed. 32 if (cleanValue !== value) { 33 $this.val(cleanValue); 34 } 35 }); 36 // Real-time input validation - Name on Account (only letters and spaces, max 22). 37 $('#anet-echeck-edit-name-on-account').on('input', function (e) { 38 var $this = $(this); 39 var value = $this.val(); 40 // Remove any non-letter/non-space characters and limit length. 41 var cleanValue = value.replace(/[^A-Za-z\s]/g, ''); // Remove non-letters and non-spaces. 42 if (cleanValue.length > 22) { 43 cleanValue = cleanValue.substring(0, 22); // Limit to 22 characters. 44 } 45 // Update field if value changed. 46 if (cleanValue !== value) { 47 $this.val(cleanValue); 48 } 49 }); 50 // Save button validation. 51 $('#anet-echeck-save-btn').on('click', function (e) { 52 e.preventDefault(); 53 var $error = $('#anet-echeck-edit-error'); 54 $error.hide().text(''); 55 var accountNumber = String($('#anet-echeck-edit-account-number').val()).trim(); 56 var routingNumber = String($('#anet-echeck-edit-routing-number').val()).trim(); 57 var accountType = $('#anet-echeck-edit-account-type').val(); 58 var nameOnAccount = String($('#anet-echeck-edit-name-on-account').val()).trim(); 59 const isAccountNumberMasked = accountNumber.startsWith('XXXX'); 60 const isRoutingNumberMasked = routingNumber.startsWith('XXXX'); 61 // Validate account number. 62 if (accountNumber === '') { 63 $error.text('Please enter an account number.').show(); 64 $('#anet-echeck-edit-account-number').focus(); 65 return false; 66 } 67 if (!isAccountNumberMasked) { 68 // Check if account number contains only digits. 69 if (!/^\d+$/.test(accountNumber)) { 70 $error.text('Account number must contain only digits (0-9).').show(); 71 $('#anet-echeck-edit-account-number').focus(); 72 return false; 73 } 74 // Check if account number is within valid length (4-17 digits). 75 if (accountNumber.length < 4 || accountNumber.length > 17) { 76 $error.text('Account number must be between 4 and 17 digits.').show(); 77 $('#anet-echeck-edit-account-number').focus(); 78 return false; 79 } 80 } 81 // Validate routing number. 82 if (routingNumber === '') { 83 $error.text('Please enter a routing number.').show(); 84 $('#anet-echeck-edit-routing-number').focus(); 85 return false;
86 } 87 if (!isRoutingNumberMasked) { 88 // Check if routing number contains only digits. 89 if (!/^\d+$/.test(routingNumber)) { 90 $error.text('Routing number must contain only digits (0-9).').show(); 91 $('#anet-echeck-edit-routing-number').focus(); 92 return false; 93 } 94 // Check if routing number is exactly 9 digits. 95 if (routingNumber.length !== 9) { 96 $error.text('Routing number must be exactly 9 digits.').show(); 97 $('#anet-echeck-edit-routing-number').focus(); 98 return false; 99 } 100 } 101 // Validate account type. 102 if (ANET_ECHECK_ACCOUNT_TYPE_CHECKING !== accountType && ANET_ECHECK_ACCOUNT_TYPE_SAVINGS !== accountType) { 103 $error.text('Please select a valid account type.').show(); 104 $('#anet-echeck-edit-account-type').focus(); 105 return false; 106 } 107 // Validate name on account. 108 if (nameOnAccount === '') { 109 $error.text('Please enter the name on the account.').show(); 110 $('#anet-echeck-edit-name-on-account').focus(); 111 return false; 112 } 113 // Check if name contains only alphabets and spaces. 114 if (!/^[A-Za-z\s]+$/.test(nameOnAccount)) { 115 $error.text('Name on account must contain only letters and spaces.').show(); 116 $('#anet-echeck-edit-name-on-account').focus(); 117 return false; 118 } 119 // Check if name is within valid length (max 22 characters). 120 if (nameOnAccount.length > 22) { 121 $error.text('Name on account must not exceed 22 characters.').show(); 122 $('#anet-echeck-edit-name-on-account').focus(); 123 return false; 124 } 125 $('#anet-echeck-edit-form form').submit(); 126 }); 127});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.