{ "@context" : "http://schema.org", "@type" : "Organization", "image" : "https://www.e-aircraftsupply.com/images/main/jaco-logo3.png", "telephone" : "(626) 855-2870", "name" : "Jaco Aerospace & Industrial", "url" : "https://e-aircraftsupply.com/spec2000Calculator.html", "email" : "[email protected]", "description" : "An easy to use specifications calculator", "brand" : "Jaco Aerospace", "address" : { "@type" : "PostalAddress", "addressLocality" : "Pasadena", "addressRegion" : "CA" } } //function to verify part number meets Spec 2000 function testPN() { let inputText = document.getElementById("pnText").value; //maximum number of characters allowed in the part number let maxChars = 15; //remove any leading and/or trailing spaces from the inputted part number inputText = inputText.trim(); //Alert user if the submit button was pressed with no part number entered if (inputText == "") { alert("Please enter a part number to analyze."); } else { //define variables let errorFound = false; let errorText = []; //Verify max length if (inputText.length > maxChars) { errorFound = true; errorText.push("The maximum number of characters is " + maxChars + ". The part number entered has " + inputText.length + "."); } //Verify no spaces if (inputText.indexOf(' ') != -1) { errorFound = true; errorText.push("No spaces are allowed in the part number per ATA Spec 2000."); } //Verify uppercase only let lowerPatt = new RegExp("[a-z]"); if (lowerPatt.test(inputText)) { errorFound = true; errorText.push("No lowercase letters are allowed per ATA Spec 2000."); } //Verify no use of the letter "O" if (inputText.indexOf('O') != -1 || inputText.indexOf('o') != -1) { errorFound = true; errorText.push("The letter \"O\" is not allowed per ATA Spec 2000."); } //Verify does not start or end with "-" let startingDash = new RegExp("^-"); let endingDash = new RegExp("-$"); if (startingDash.test(inputText) || endingDash.test(inputText)) { errorFound = true; errorText.push("The part number cannot start or end with a \"-\" per ATA Spec 2000."); } //Verify only use "-" beteen numeric characters let numHyphen = new RegExp("[^0-9]-"); let hyphenNum = new RegExp("-[^0-9]"); if (numHyphen.test(inputText) || hyphenNum.test(inputText)) { errorFound = true; errorText.push("Only numeric characters are allowed next to a hyphen per ATA Spec 2000."); } //verify no special characters used //NOTE: lowercase letters, periods, and spaces are included since they are being checked elsewhere. // This prevents duplicate feedback entries. let nonSpecial = new RegExp("[^0-9a-zA-Z-. ]"); if (nonSpecial.test(inputText)) { errorFound = true; errorText.push("No special characters (e.g. /, \\, *, &, #, etc.) are allowed per ATA Spec 2000."); } //Look for periods and warn if used if (inputText.indexOf('.') !== -1) { errorText.push("Note: The use of periods in the part number is allowed, but not recommended."); } //Compile feedback to user let errorMessage = ""; if (errorFound) { errorMessage = "<p style='color: red;'>The part number is not compliant with ATA Spec 2000.</p><p>"; for (let i = 0; i < errorText.length; i++) { errorMessage += (i + 1) + ". " + errorText[i] + "<br>"; } errorMessage += "</p>"; } else { errorMessage = "<p>The part number is compliant with ATA Spec 2000.</p><p>"; for (let i = 0; i < errorText.length; i++) { errorMessage += (i + 1) + ". " + errorText[i] + "<br>"; } errorMessage += "</p>"; } document.getElementById("feedback").innerHTML = errorMessage; } } //This function clears the input field, and clears the feedback text from any previously tested part number function clearText() { document.getElementById("pnText").value = ""; document.getElementById("feedback").innerHTML = ""; }
Spec 2000 Part Number Audit Tool
Insert part number and submit to see if the part number complies with ATA Spec 2000 standards.
Submit Clear