1// ------------------------------------------------------------------------------------------------ 2// - í¼ì²´í¬ ê¸°ë¥ (written by luckshim) 3// ------------------------------------------------------------------------------------------------ 4/** 5validator.checkIsNumber("ctbCoCd", "CoCd 를 ì ë ¥í´ ì£¼ì¸ì1.", true); 6validator.checkBetweenNum("ctbCoCd", 1, 3, "1-3 ì¬ì´ì ê¸ì ì ë ¥í´ì£¼ì¸ì", true); 7validator.checkContains("ctbGLAct", "test", "test ë¼ë ê¸ìë ê¸ì¹ì´ì ëë¤.", true); 8validator.checkSelected("ddlCtye", 1, "ëë²ì§¸ë¶í° ì ííì¸ì.", true); 9validator.checkWhiteSpace("ctbCoCd", "공백ì ì ë ¥íìë©´ ìë©ëë¤.", true); 10validator.checkMaxLength("ctbCoCd", 5, "5ì ì´ê³¼íë©´ ìë©ëë¤.", true); 11validator.checkMinLength("ctbCoCd", 5, "5ì 미ë§ì´ë©´ ìë©ëë¤.", true); 12validator.checkBetweenLength("ctbCoCd", 1,5, "1~5ì ì´ë´ì¬ì¼ í©ëë¤.", true); 13*/ 14 15/** 16* í¼ì²´í¬ í´ëì¤ - checkForm ìì ê²½ì° idë¡ ì²´í¬í¨ - alertFunc ìì ê²½ì° alert() ê²½ê³ ì°½ 17* 18* @param {form object} checkForm ì²´í¬í í¼ 19* @param {function object} alertFunc ê²½ê³ ì°½ì íìí í¨ì 20*/ 21Validator = function (checkForm, alertFunc) { 22 this.checkForm = checkForm; 23 this.validateObjectArray = new Array(); 24 this.alertFunc = alertFunc; // ê²½ê³ ì°½ í¨ì 25} 26 27/** 28* ì í¨ì± ê°ì²´ 29* 30* @param {string} identifier id ëë name 31* @param {string} errorMessage ìë¬ë©ìì§ 32* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 33*/ 34Validator.prototype.ValidateObject = function (identifier, errorMessage, focusFlag) { 35 this.identifier = identifier; 36 this.errorMessage = errorMessage; 37 this.focusFlag = focusFlag; 38} 39 40/** 41* id ëë nameì¼ë¡ ìë¦¬ë¨¼í¸ ê°ì²´ë¥¼ íë 42* 43* @param {string} identifier id ëë name 44* @return {element object} ìë¦¬ë¨¼í¸ ê°ì²´ 45*/ 46Validator.prototype.getElement = function (identifier) { 47 if (this.checkForm && this.checkForm.nodeName == "FORM") { 48 return this.checkForm[identifier]; 49 } else { 50 return document.getElementById(identifier); 51 } 52} 53 54/** 55* ì í¨ì± ê²ì¬ 56* 57* @return {boolean} ì í¨ì± ê²ì¬ê²°ê³¼ 58*/ 59Validator.prototype.validate = function () { 60 for (var i = 0; i < this.validateObjectArray.length; i++) { 61 var validateObject = this.validateObjectArray[i]; 62 if (!validateObject.validate()) { 63 if (this.alertFunc) this.alertFunc(validateObject.errorMessage); 64 else alert(validateObject.errorMessage); 65 if (validateObject.focusFlag) { 66 this.getElement(validateObject.identifier).focus(); 67 } 68 this.validateObjectArray = new Array(); 69 return false; 70 } 71 } 72 this.validateObjectArray = new Array(); 73 return true; 74} 75 76/** 77* ê°ì ì ë ¥íëì§ì ì¬ë¶ë¥¼ ê²ì¬ 78* 79* @param {string} identifier id ëë name 80* @param {string} errorMessage ìë¬ë©ìì§ 81* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 82*/ 83Validator.prototype.checkRequired = function (identifier, errorMessage, focusFlag) { 84 var checkElement = $("#" + identifier); 85 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 86 validateObject.validate = function () { 87 return (checkElement.val()).replace(/^\s*/, "").replace(/\s*$/, "") != ""; 88 } 89 this.validateObjectArray.push(validateObject); 90} 91 92/** 93* ê°ì 길ì´ê° maxLengthë³´ë¤ ìê±°ë ê°ìì§ ê²ì¬ 94* 95* @param {string} identifier id ëë name 96* @param {int} maxLength ì²´í¬ê° 97* @param {string} errorMessage ìë¬ë©ìì§ 98* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 99*/ 100Validator.prototype.checkMaxLength = function (identifier, maxLength, errorMessage, focusFlag) { 101 var checkElement = $("#" + identifier); 102 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 103 validateObject.validate = function () { 104 var stringValue = checkElement.val(); 105 //alert("callme " + stringValue.length <= maxLength); 106 return (stringValue.length <= maxLength); 107 } 108 this.validateObjectArray.push(validateObject); 109} 110 111/** 112* ê°ì 길ì´ê° minLengthë³´ë¤ í¬ê±°ë ê°ìì§ ê²ì¬ 113* 114* @param {string} identifier id ëë name 115* @param {int} minLength ì²´í¬ê° 116* @param {string} errorMessage ìë¬ë©ìì§ 117* @param {boolean}
117 focusFlag í¬ì»¤ì¤ì¬ë¶ 118*/ 119Validator.prototype.checkMinLength = function (identifier, minLength, errorMessage, focusFlag) { 120 var checkElement = $("#" + identifier); 121 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 122 validateObject.validate = function () { 123 var stringValue = checkElement.val(); 124 return (minLength <= stringValue.length); 125 } 126 this.validateObjectArray.push(validateObject); 127} 128 129/** 130* ê°ì 길ì´ê° minLengthì maxLengthì¬ì´ì ìëì§ ê²ì¬ 131* 132* @param {string} identifier id ëë name 133* @param {int} minLength ì²´í¬ê° 134* @param {int} maxLength ì²´í¬ê° 135* @param {string} errorMessage ìë¬ë©ìì§ 136* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 137*/ 138Validator.prototype.checkBetweenLength = function (identifier, minLength, maxLength, errorMessage, focusFlag) { 139 var checkElement = $("#" + identifier); 140 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 141 validateObject.validate = function () { 142 var stringValue = checkElement.val(); 143 return (minLength <= stringValue.length && stringValue.length <= maxLength); 144 } 145 this.validateObjectArray.push(validateObject); 146} 147 148/** 149* ê°ì ë°ì´í¸ 길ì´ê° maxLengthë³´ë¤ ìê±°ë ê°ìì§ ê²ì¬ 150* 151* @param {string} identifier id ëë name 152* @param {int} maxLength ì²´í¬ê° 153* @param {int} kbyte íê¸ë°ì´í¸ì 154* @param {string} errorMessage ìë¬ë©ìì§ 155* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 156*/ 157Validator.prototype.checkMaxLengthByte = function (identifier, maxLength, kbyte, errorMessage, focusFlag) { 158 var checkElement = $("#" + identifier); 159 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 160 validateObject.validate = function () { 161 var stringValue = checkElement.val(); 162 var nbytes = 0; 163 for (i = 0; i < stringValue.length; i++) { 164 var ch = stringValue.charAt(i); 165 if (escape(ch).length > 4) { 166 nbytes += kbyte; 167 } else if (ch == '\n') { 168 if (stringValue.charAt(i - 1) != '\r') { 169 nbytes += 1; 170 } 171 } else if (ch == '<' || ch == '>') { 172 nbytes += 4; 173 } else { 174 nbytes += 1; 175 } 176 } 177 return (nbytes <= maxLength); 178 } 179 this.validateObjectArray.push(validateObject); 180} 181 182/** 183* ê°ì ë°ì´í¸ 길ì´ê° minLengthë³´ë¤ ìê±°ë ê°ìì§ ê²ì¬ 184* 185* @param {string} identifier id ëë name 186* @param {int} minLength ì²´í¬ê° 187* @param {int} kbyte íê¸ë°ì´í¸ì 188* @param {string} errorMessage ìë¬ë©ìì§ 189* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 190*/ 191Validator.prototype.checkMinLengthByte = function (identifier, minLength, kbyte, errorMessage, focusFlag) { 192 var checkElement = $("#" + identifier); 193 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 194 validateObject.validate = function () { 195 var stringValue = checkElement.val(); 196 var nbytes = 0; 197 for (i = 0; i < stringValue.length; i++) { 198 var ch = stringValue.charAt(i); 199 if (escape(ch).length > 4) { 200 nbytes += kbyte; 201 } else if (ch == '\n') { 202 if (stringValue.charAt(i - 1) != '\r') { 203 nbytes += 1; 204 } 205 } else if (ch == '<' || ch == '>') { 206 nbytes += 4; 207 } else { 208 nbytes += 1; 209 } 210 } 211 return (nbytes >= minLength); 212 } 213 this.validateObjectArray.push(validateObject); 214} 215 216/** 217* ê°ì ë°ì´í¸ 길ì´ê° minLengthì maxLengthì¬ì´ì ìëì§ ê²ì¬ 218* 219* @param {string} identifier id ëë name 220* @param {int} minLength ì²´í¬ê° 221* @param {int} maxLength ì²´í¬ê° 222* @param {int} kbyte íê¸ë°ì´í¸ì 223* @param {string} errorMessage ìë¬ë©ìì§ 224* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 225*/ 226Validator.prototype.checkBetweenLengthByte = function (identifier, minLength, maxLength, kbyte, errorMessage, focusFlag) { 227 var checkElement = $("#" + identifier);
228 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 229 validateObject.validate = function () { 230 var stringValue = checkElement.val(); 231 var nbytes = 0; 232 for (i = 0; i < stringValue.length; i++) { 233 var ch = stringValue.charAt(i); 234 if (escape(ch).length > 4) { 235 nbytes += kbyte; 236 } else if (ch == '\n') { 237 if (stringValue.charAt(i - 1) != '\r') { 238 nbytes += 1; 239 } 240 } else if (ch == '<' || ch == '>') { 241 nbytes += 4; 242 } else { 243 nbytes += 1; 244 } 245 } 246 return (minLength <= nbytes && nbytes <= maxLength); 247 } 248 this.validateObjectArray.push(validateObject); 249} 250 251/** 252* ê°ì´ ì ê·ííìì í´ë¹íë ì§ ê²ì¬ 253* 254* @param {string} identifier id ëë name 255* @param {string} regex ì ê·ííì 256* @param {boolean} includeFlag ì ê·ííì í´ë¹ì¬ë¶ í¬í¨ëì´ì¼í ë true 257* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 258*/ 259Validator.prototype.checkRegex = function (identifier, regex, includeFlag, errorMessage, focusFlag) { 260 var checkElement = $("#" + identifier); 261 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 262 validateObject.validate = function () { 263 var str = checkElement.val(); 264 if (str.length == 0) return true; 265 if (includeFlag) return str.search(regex) != -1; 266 else return str.search(regex) == -1; 267 } 268 this.validateObjectArray.push(validateObject); 269} 270 271/** 272* ê°ì´ ìí벳과 0~9ì¬ì´ì ì«ìë§ í¬í¨íë ì§ ê²ì¬ 273* 274* @param {string} identifier id ëë name 275* @param {string} errorMessage ìë¬ë©ìì§ 276* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 277*/ 278Validator.prototype.checkAlphaNum = function (identifier, errorMessage, focusFlag) { 279 this.checkRegex(identifier, /^[a-zA-Z0-9]+$/, true, errorMessage, focusFlag); 280} 281 282/** 283* ê°ì´ 0~9 ì¬ì´ì 문ìë§ í¬í¨íë ì§ ê²ì¬ 284* 285* @param {string} identifier id ëë name 286* @param {string} errorMessage ìë¬ë©ìì§ 287* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 288*/ 289Validator.prototype.checkOnlyNumber = function (identifier, errorMessage, focusFlag) { 290 this.checkRegex(identifier, /^[0-9]+$/, true, errorMessage, focusFlag); 291} 292 293/** 294* ìëì문ìë§ ì ë ¥ì¸ì§ ê²ì¬ 295* 296* @param {string} identifier id ëë name 297* @param {string} errorMessage ìë¬ë©ìì§ 298* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 299*/ 300Validator.prototype.checkOnlyAlpabat = function (identifier, errorMessage, focusFlag) { 301 this.checkRegex(identifier, /^[A-za-z]+$/, true, errorMessage, focusFlag); 302} 303 304/** 305* ê°ì´ ì¬ë°ë¥¸ ì´ë©ì¼ 주ìì¸ì§ ê²ì¬ 306* 307* @param {string} identifier id ëë name 308* @param {string} errorMessage ìë¬ë©ìì§ 309* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 310*/ 311Validator.prototype.checkEmail = function (identifier, errorMessage, focusFlag) { 312 this.checkRegex(identifier, /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/, true, errorMessage, focusFlag); 313} 314 315/** 316* ì¬ë°ë¥¸ 주ìì¸ì§ ê²ì¬ 317* 318* @param {string} identifier id ëë name 319* @param {string} errorMessage ìë¬ë©ìì§ 320* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 321*/ 322Validator.prototype.checkUrl = function (identifier, errorMessage, focusFlag) { 323 this.checkRegex(identifier, /^(?:(?:ftp|https?):\/\/)?(?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)+(?:com|edu|biz|org|gov|int|info|mil|net|name|museum|coop|aero|[a-z][a-z])\b(?:\d+)?(?:\/[^;"'<>()\[\]{}\s\x7f-\xff]*(?:[.,?]+[^;"'<>()\[\]{}\s\x7f-\xff]+)*)?/, true, errorMessage, focusFlag); 324} 325 326/** 327* í¹ì문ì ê²ì¬ 328* 329* @param {string} identifier id ëë name 330* @param {string} errorMessage ìë¬ë©ìì§ 331* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 332*/ 333Validator.prototype.checkSpecialChar = function (identifier, errorMessage, focusFlag) { 334 this.checkRegex(identifier, /[~!@\#$%^&*\()\-=+_']/, false, errorMessage, focusFlag); 335} 336 337/** 338* 공백 ê²ì¬ 339* 340* @param {string} identifier id ëë name 341* @param {string} errorMessage ìë¬ë©ìì§ 342* @param {boolean}
342 focusFlag í¬ì»¤ì¤ì¬ë¶ 343*/ 344Validator.prototype.checkWhiteSpace = function (identifier, errorMessage, focusFlag) { 345 this.checkRegex(identifier, /\s/g, false, errorMessage, focusFlag); 346} 347 348/** 349* <select>ìì ì íí ìµì ì ì¸ë±ì¤ê° firstIdxë³´ë¤ í¬ê±°ë ê°ì ì§ ê²ì¬íë¤. 350* 351* @param {string} identifier id ëë name 352* @param {int} firstIdx ìµì ì¸ë±ì¤ 353* @param {string} errorMessage ìë¬ë©ìì§ 354* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 355*/ 356Validator.prototype.checkSelected = function (identifier, firstIdx, errorMessage, focusFlag) { 357 var checkElement = this.getElement(identifier); 358 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 359 validateObject.validate = function () { 360 var idx = checkElement.selectedIndex; 361 return idx >= firstIdx; 362 } 363 this.validateObjectArray.push(validateObject); 364} 365 366/** 367* checkboxë radio ì ë ¥ ììê° ìµìí 1ê° ì´ì ì íëëì§ ê²ì¬ 368* 369* @param {string} identifier id ëë name 370* @param {string} errorMessage ìë¬ë©ìì§ 371* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 372*/ 373Validator.prototype.checkAtLeastOneChecked = function (identifier, errorMessage, focusFlag) { 374 var validateObject = new this.ValidateObject(null, errorMessage, false); 375 validateObject.validate = function () { 376 var ele = document.getElementsByName(identifier); 377 for (var idxe = 0; idxe < ele.length; idxe++) { 378 if (ele[idxe].checked == true) return true; 379 } 380 return false; 381 } 382 this.validateObjectArray.push(validateObject); 383} 384 385/** 386* checkboxlist ì ë ¥ ììê° 1ê° ì´ì ì íëëì§ ê²ì¬ 387* 388* @param {string} identifier id ëë name 389* @param {string} errorMessage ìë¬ë©ìì§ 390* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 391*/ 392Validator.prototype.checkboxListChecked = function (identifier, errorMessage, focusFlag) { 393 394 var validateObject = new this.ValidateObject(null, errorMessage, false); 395 validateObject.validate = function () { 396 var res = $("[id^=" + identifier + "]:checkbox:checked").length > 0; 397 return res; 398 } 399 this.validateObjectArray.push(validateObject); 400} 401 402/** 403* í¹ì 문ìì´ì´ í¬í¨ëìëì§ ê²ì¬ 404* 405* @param {string} identifier id ëë name 406* @param {string} checkContainText í¬í¨ 문ìì´ 407* @param {string} errorMessage ìë¬ë©ìì§ 408* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 409*/ 410Validator.prototype.checkContains = function (identifier, checkContainText, errorMessage, focusFlag) { 411 var checkElement = $("#" + identifier); 412 var validateObject = new this.ValidateObject(identifier, errorMessage, false); 413 validateObject.validate = function () { 414 return checkElement.val().indexOf(checkContainText) == -1; 415 } 416 this.validateObjectArray.push(validateObject); 417} 418 419/** 420* ì ë ¥ë ì«ìê° ì§ì ë ë²ìì ì«ìì¸ì§ ì²´í¬ 421* 422* @param {string} identifier id ëë name 423* @param {int} minNum ì§ì ìµì ì 424* @param {int} maxNum ì§ì ìµë ì 425* @param {string} errorMessage ìë¬ë©ìì§ 426* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 427*/ 428Validator.prototype.checkBetweenNum = function (identifier, minNum, maxNum, errorMessage, focusFlag) { 429 var checkElement = $("#" + identifier); 430 var validateObject = new this.ValidateObject(identifier, errorMessage, false); 431 validateObject.validate = function () { 432 var number = checkElement.val(); 433 return (number >= minNum && number <= maxNum); 434 } 435 this.validateObjectArray.push(validateObject); 436} 437 438/** 439* isNaN í¨ìë¡ ì«ìì¬ë¶ ì²´í¬ 440* 441* @param {string} identifier id ëë name 442* @param {string} errorMessage ìë¬ë©ìì§ 443* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 444*/ 445Validator.prototype.checkIsNumber = function (identifier, errorMessage, focusFlag) { 446 var checkElement = $("#" + identifier); 447 var validateObject = new this.ValidateObject(identifier, errorMessage, false); 448 validateObject.validate = function () { 449 var val = checkElement.val(); 450 return !isNaN(val); 451 } 452 this.validateObjectArray.push(validateObject); 453} 454 455/**
456* 콤ë§(,)를 ì ê±°í isNaN í¨ìë¡ ê¸ì¡ì¬ë¶ ì²´í¬ 457* 458* @param {string} identifier id ëë name 459* @param {string} errorMessage ìë¬ë©ìì§ 460* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 461*/ 462Validator.prototype.checkIsMoney = function (identifier, errorMessage, focusFlag) { 463 var checkElement = $("#" + identifier); 464 var validateObject = new this.ValidateObject(identifier, errorMessage, false); 465 validateObject.validate = function () { 466 var val = checkElement.val().replace(/,/g, ""); 467 return !isNaN(val); 468 } 469 this.validateObjectArray.push(validateObject); 470} 471 472/** 473* <select>ìì ì íí ìµì ì ê°ì íì¸íë¤. 474* 475* @param {string} identifier id ëë name 476* @param {int} firstIdx ìµì ì¸ë±ì¤ 477* @param {string} errorMessage ìë¬ë©ìì§ 478* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 479*/ 480Validator.prototype.checkSelectedValue = function (identifier, defaultValue, errorMessage, focusFlag) { 481 var checkElement = this.getElement(identifier); 482 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 483 validateObject.validate = function () { 484 var nowSelectedValue = $(checkElement).val(); 485 return (nowSelectedValue == defaultValue ? false : true) 486 } 487 this.validateObjectArray.push(validateObject); 488} 489 490 491/** 492* 주민ë²í¸ì ì í¨ì±ì ê²ì¬íë¤. 493* 494* @param {string} identifier id ëë name 495* @param {string} errorMessage ìë¬ë©ìì§ 496* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 497*/ 498Validator.prototype.checkRes = function (identifier, errorMessage, focusFlag) { 499 var checkElement = $("#" + identifier); 500 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 501 validateObject.validate = function () { 502 var ssn = checkElement.val(); 503 ssn = ssn.replace(/-/g, ""); 504 505 var sum = 0; 506 var month = ssn.substr(2, 2); 507 var day = ssn.substr(4, 2); 508 509 if (ssn.length != 13) { 510 return false; 511 } 512 513 if (ssn.substr(7, 5) == "00000") { 514 return false; 515 } 516 517 var checkBit = new Array(2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5); 518 var num7 = ssn.charAt(6); 519 var num13 = ssn.charAt(12); 520 var total = 0; 521 if (ssn.length == 13) { 522 for (i = 0; i < checkBit.length; i++) { // 주민ë²í¸ 12ì리를 í¤ê°ì ê³±íì¬ í©ì°íë¤. 523 total += ssn.charAt(i) * checkBit[i]; 524 } 525 // ì¸êµì¸ êµ¬ë¶ ì²´í¬ 526 if (num7 == 0 || num7 == 9) { // ë´êµì¸ ( 1800ë ë 9: ë¨ì, 0:ì¬ì) 527 total = (11 - (total % 11)) % 10; 528 } 529 else if (num7 > 4) { // ì¸êµì¸ ( 1900ë ë 5:ë¨ì 6:ì¬ì 2000ë ë 7:ë¨ì, 8:ì¬ì) 530 total = (13 - (total % 11)) % 10; 531 } 532 else { // ë´êµì¸ ( 1900ë ë 1:ë¨ì 2:ì¬ì 2000ë ë 3:ë¨ì, 4:ì¬ì) 533 total = (11 - (total % 11)) % 10; 534 } 535 536 if (total != num13) { 537 return false; 538 } 539 return true; 540 } else { 541 return false; 542 } 543 } 544 this.validateObjectArray.push(validateObject); 545} 546 547 548 549/** 550* ì¬ì ìë±ë¡ë²í¸ì ì í¨ì±ì ê²ì¬íë¤. 551* 552* @param {string} identifier id ëë name 553* @param {string} errorMessage ìë¬ë©ìì§ 554* @param {boolean} focusFlag í¬ì»¤ì¤ì¬ë¶ 555*/ 556Validator.prototype.checkCompanyNumber = function (identifier, errorMessage, focusFlag) { 557 var checkElement = $("#" + identifier); 558 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 559 validateObject.validate = function () { 560 561 var compNo = checkElement.val().replace(/-/g, ""); 562 563 if (compNo == "9999999999" || compNo == "8888888888") { //í´ì¸ê±°ëì², ê°ì¸ì¬ì ì 564 return true; 565 } 566 567 var sum = 0; 568 var getlist = new Array(10); 569 var chkvalue = new Array("1", "3", "7", "1", "3", "7", "1", "3", "5"); 570 for (var i = 0; i < 10; i++) { getlist[i] = compNo.substring(i, i + 1); } 571 for (var i = 0; i < 9; i++) { sum += getlist[i] * chkvalue[i]; } 572 sum = sum + parseInt((getlist[8] * 5) / 10); 573 sidliy = sum % 10; 574 sidchk = 0; 575 if (sidliy != 0) { sidchk = 10 - sidliy; } 576 else { sidchk = 0; } 577 if (sidchk != getlist[9]) { return false; } 578 return true; 579 } 580 this.validateObjectArray.push(validateObject); 581} 582 583 584 585 586/** 587* ()를 ì ì¸í í¹ì문ì ê¸ì§ 588* @param {string} identifier id ëë name 589* @param {string} errorMessage ìë¬ë©ìì§ 590* @param {boolean}
590 focusFlag í¬ì»¤ì¤ì¬ë¶ 591*/ 592Validator.prototype.checkSpecialCharNotIncParenthesis = function (identifier, errorMessage, focusFlag) { 593 var checkElement = $("#" + identifier); 594 var validateObject = new this.ValidateObject(identifier, errorMessage, focusFlag); 595 validateObject.validate = function () { 596 597 var regexp = /[0-9a-zA-Zã±-ã |ã -ã £|ê°-í£()-ï¼]/; 598 var text = checkElement.val(); 599 600 var b = true; 601 for (var i = 0 ; i < text.length; i++) { 602 if (text.charAt(i) != " " && regexp.test(text.charAt(i)) == false) { 603 b = false; 604 break; 605 } 606 } 607 return b; 608 } 609 this.validateObjectArray.push(validateObject); 610 611}
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.