1function validate_input(cls_id, cls_err, id) { 2 console.log('here') 3 const input = document.getElementById(cls_id + id); 4 const err = document.getElementById(cls_err + id); 5 var data_val = input.getAttribute('data-val'); 6 var data_maxLength = input.getAttribute('data-val-maxLength'); 7 var data_minLength = input.getAttribute('data-val-minLength'); 8 if (input.hasAttribute('required')) { 9 if (!input.value) { 10 input.setAttribute('aria-invalid', true) 11 } else { 12 if (input.getAttribute('type') == 'email') { 13 var validRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 14 if (!input.value.match(validRegex)) { 15 input.setAttribute('aria-invalid', true); 16 } else { 17 if (data_maxLength != null || data_minLength != null) { 18 if (data_val == 'by_char') { 19 if (data_minLength > input.value.length || data_maxLength < input.value.length) { 20 input.setAttribute('aria-invalid', true) 21 } else { 22 input.setAttribute('aria-invalid', false); 23 } 24 } else if (data_val == 'by_word') { 25 var text = input.value; 26 var word_length = (text) ? text.match(/(\w+)/g).length : 0; 27 if (data_minLength > word_length || data_maxLength < word_length) { 28 input.setAttribute('aria-invalid', true) 29 } else { 30 input.setAttribute('aria-invalid', false); 31 } 32 } else { 33 input.setAttribute('aria-invalid', false); 34 } 35 } else { 36 input.setAttribute('aria-invalid', false); 37 } 38 } 39 } else { 40 if (data_maxLength != null || data_minLength != null) { 41 if (data_val == 'by_char') { 42 if (data_minLength > input.value.length || data_maxLength < input.value.length) { 43 input.setAttribute('aria-invalid', true) 44 } else { 45 input.setAttribute('aria-invalid', false); 46 } 47 } else if (data_val == 'by_word') { 48 var text = input.value; 49 var word_length = (text) ? text.match(/(\w+)/g).length : 0; 50 if (data_minLength > word_length || data_maxLength < word_length) { 51 input.setAttribute('aria-invalid', true) 52 } else { 53 input.setAttribute('aria-invalid', false); 54 } 55 } else { 56 input.setAttribute('aria-invalid', false); 57 } 58 } else { 59 input.setAttribute('aria-invalid', false); 60 } 61 } 62 } 63 } else { 64 if (input.getAttribute('type') == 'email' && input.value != '' ) { 65 var validRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 66 if (!input.value.match(validRegex)) { 67 input.setAttribute('aria-invalid', true); 68 } else { 69 if (data_maxLength != null || data_minLength != null) { 70 if (data_val == 'by_char') { 71 if (data_minLength > input.value.length || data_maxLength < input.value.length) { 72 input.setAttribute('aria-invalid', true) 73 } else { 74 input.setAttribute('aria-invalid', false); 75 } 76 } else if (data_val == 'by_word') { 77 var text = input.value; 78 var word_length = (text) ? text.match(/(\w+)/g).length : 0; 79 if (data_minLength > word_length || data_maxLength < word_length) { 80 input.setAttribute('aria-invalid', true) 81 } else { 82 input.setAttribute('aria-invalid', false); 83 } 84 } else { 85 input.setAttribute('aria-invalid', false); 86 } 87 } else { 88 input.setAttribute('aria-invalid', false); 89 } 90 } 91 } else { 92 if (data_maxLength != null || data_minLength != null) { 93 if (data_val == 'by_char') { 94 if (data_minLength > input.value.length || data_maxLength < input.value.length) { 95 input.setAttribute('aria-invalid', true) 96 } else { 97 input.setAttribute('aria-invalid', false); 98 } 99 } else if (data_val == 'by_word') { 100 var text = input.value; 101 var word_length = (text) ? text.match(/(\w+)/g).length : 0; 102 if (data_minLength > word_length || data_maxLength < word_length) { 103 input.setAttribute('aria-invalid', true) 104 } else { 105 input.setAttribute('aria-invalid', false); 106 } 107 } else { 108 input.setAttribute('aria-invalid', false); 109 } 110 } else { 111 input.setAttribute('aria-invalid', false); 112 } 113 } 114 } 115 116}
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.