//********************************************** // JavaScript commonclass.js // 2003/03/05 //********************************************** //************************************************** // テキストクラス //************************************************** function UTLText( bHissu, txtObj, type, minLength, maxLength, sName ) { this.bHissu = bHissu; this.txtObj = txtObj; this.type = type; this.minLength = minLength; this.maxLength = maxLength; this.sName = sName; // チェック関数 this.Check = function() { if ( this.bHissu == true || this.txtObj.value != "" ) { // NULLチェック if ( NullCheck ( this.txtObj, this.sName ) == false ) return false; // チェッカークラス生成 var clsChecker = CheckerFactory ( this.type ); // 文字種別チェック if ( clsChecker.CheckType ( this.txtObj ) == false ) return false; // Lengthチェック var sErrMsg = clsChecker.CheckLength ( this.txtObj.value, this.minLength, this.maxLength ); if ( sErrMsg != "" ) { ShowError ( sName + "は" + sErrMsg, this.txtObj ); return false; } } return true; } // 値取得 this.GetValue = function() { return this.txtObj.value; } } //************************************************** // 氏名クラス //************************************************** function UTLName( bHissu, txtName1, txtName2, type, maxLength, sName1, sName2 ) { this.bHissu = bHissu; this.txtName1 = txtName1; this.txtName2 = txtName2; this.type = type; this.maxLength = maxLength; this.sName1 = sName1; this.sName2 = sName2; // チェック関数 this.Check = function() { // NULLチェック if ( this.bHissu == true && NullCheck ( this.txtName1, this.sName1 ) == false ) return false; if ( this.bHissu == true && NullCheck ( this.txtName2, this.sName2 ) == false ) return false; // チェッカークラス生成 var clsChecker = CheckerFactory ( this.type ); // 文字種別チェック if ( clsChecker.CheckType( this.txtName1 ) == false ) return false; if ( clsChecker.CheckType( this.txtName2 ) == false ) return false; // Lengthチェック var sName = this.txtName1.value + this.txtName2.value; var sErrMsg = clsChecker.CheckLength ( sName, 0, this.maxLength ); if ( sErrMsg != "" ) { ShowError ( "氏名合わせて" + sErrMsg, this.txtName1 ); return false; } return true; } // 値を取得 this.GetValue = function() { var sRet = this.txtName1.value + this.txtName2.value; return sRet.toUpperCase(); } } //************************************************** // 郵便番号クラス //************************************************** function UTLZip( bHissu, txtZip1, txtZip2, sName1, sName2 ) { this.bHissu = bHissu; this.txtZip1 = txtZip1; this.txtZip2 = txtZip2; this.sName1 = sName1; this.sName2 = sName2; // チェック関数 this.Check = function() { if ( this.bHissu == true || this.txtZip1.value != "" || this.txtZip2.value != "" ) { // NULLチェック if ( NullCheck ( this.txtZip1, this.sName1 ) == false ) return false; if ( NullCheck ( this.txtZip2, this.sName2 ) == false ) return false; // チェッカークラス生成 var clsChecker = CheckerFactory ( C_TYPE_TEXT_NUMBER ); // 文字種別チェック if ( clsChecker.CheckType( this.txtZip1 ) == false ) return false; if ( clsChecker.CheckType( this.txtZip2 ) == false ) return false; // 桁数チェック var sErrMsg = clsChecker.CheckLength ( this.txtZip1.value, 3, 3 ); if ( sErrMsg != "" ) { ShowError ( this.sName1 + "は" + sErrMsg, this.txtZip1 ); return false; } var sErrMsg = clsChecker.CheckLength ( this.txtZip2.value, 4, 4 ); if ( sErrMsg != "" ) { ShowError ( this.sName2 + "は" + sErrMsg, this.txtZip2 ); return false; } // 内容チェック if ( this.txtZip1.value == "000" ) { ShowError ( msg( WSN1054 ), this.txtZip1 ); return false; } /* 296WEB郵便番号入力チェック変更対応 2007/06/28 */ /*if ( this.txtZip2.value == "0000" ) { ShowError ( msg( WSN1055 ), this.txtZip1 ); return false; }*/ } return true; } } //************************************************** // 電話番号クラス //************************************************** function UTLTel( bHissu, txtTel1, txtTel2, txtTel3, telType, sName1, sName2, sName3 ) { this.bHissu = bHissu; this.txtTel1 = txtTel1; this.txtTel2 = txtTel2; this.txtTel3 = txtTel3; this.telType = telType; this.sName1 = sName1; this.sName2 = sName2; this.sName3 = sName3; // チェック関数 this.Check = function() { if ( this.bHissu == true || this.txtTel1.value != "" || this.txtTel2.value != "" || this.txtTel3.value != "" ) { // NULLチェック if ( NullCheck ( this.txtTel1, this.sName1 ) == false ) return false; if ( NullCheck ( this.txtTel2, this.sName2 ) == false ) return false; if ( NullCheck ( this.txtTel3, this.sName3 ) == false ) return false; // チェッカークラス生成 var clsChecker = CheckerFactory ( C_TYPE_TEXT_NUMBER ); // 文字種別チェック(半角チェック) if ( clsChecker.CheckType( this.txtTel1 ) == false ) return false; if ( clsChecker.CheckType( this.txtTel2 ) == false ) return false; if ( clsChecker.CheckType( this.txtTel3 ) == false ) return false; var sErrMsg = ""; // 内容チェック if ( this.txtTel1.value.charAt( 0 ) != "0" ) { // 最初の文字は0でないといけない ShowError ( msg( WSN1036 ), this.txtTel1 ); return false; } if ( this.telType == C_TEL_NORMAL ) { // 普通の電話 sErrMsg = clsChecker.CheckLength ( this.txtTel1.value + this.txtTel2.value + this.txtTel3.value, 9, 11 ); if ( sErrMsg != "" ) { ShowError ( "電話番号は合わせて" + sErrMsg, this.txtTel1 ); return false; } } else if ( this.telType == C_TEL_NORMAL2 ) { // 普通の電話2(携帯番号もチェックする) /* Start 統合名寄せ取込仕様変更対応で追加 kawai 2009/04/23 */ sErrMsg = clsChecker.CheckLength ( this.txtTel1.value + this.txtTel2.value + this.txtTel3.value, 9, 11 ); if ( sErrMsg != "" ) { ShowError ( "電話番号は合わせて" + sErrMsg, this.txtTel1 ); return false; } // 頭3桁 var sTelTop3 = (this.txtTel1.value + this.txtTel2.value + this.txtTel3.value).substr(0, 3); // 電話番号の頭3桁が000の時は、それ以降で1〜9の数値を含む時は、11桁以外はエラーとする。 // ALL"0"の時は、10桁、11桁以外はエラーとする if(sTelTop3 == "000") { if( (this.txtTel1.value + this.txtTel2.value + this.txtTel3.value) == "0000000000" || (this.txtTel1.value + this.txtTel2.value + this.txtTel3.value) == "00000000000" ) { // ALL"0"で10桁、11桁ならOK return true; } if( (this.txtTel1.value + this.txtTel2.value + this.txtTel3.value) == "000000000" ) { // ALL"0"で9桁ならNG sErrMsg = clsChecker.CheckLength ( this.txtTel1.value + this.txtTel2.value + this.txtTel3.value, 10, 11 ); if ( sErrMsg != "" ) { ShowError ( "電話番号は合わせて" + sErrMsg, this.txtTel1 ); return false; } } } // 電話番号の頭3桁が(0x0)の場合は、11桁以外はエラーとする if( sTelTop3 == "010" || sTelTop3 == "020" || sTelTop3 == "030" || sTelTop3 == "040" || sTelTop3 == "050" || sTelTop3 == "060" || sTelTop3 == "070" || sTelTop3 == "080" || sTelTop3 == "090" || sTelTop3 == "000") { sErrMsg = clsChecker.CheckLength ( this.txtTel1.value + this.txtTel2.value + this.txtTel3.value, 11, 11 ); if ( sErrMsg != "" ) { ShowError ( "電話番号は合わせて" + sErrMsg, this.txtTel1 ); return false; } // 電話番号の頭3桁が(0x0)の場合は、電話番号1(入力欄の1つ目)が3桁以外はエラーとする if ( this.txtTel1.value.length != 3 ) { ShowError ( "電話番号は3桁-4桁-4桁の形式で入力して下さい。", this.txtTel1 ); return false; } } else { // 電話番号の頭3桁が(0x0)以外の場合は、10桁以外はエラーとする sErrMsg = clsChecker.CheckLength ( this.txtTel1.value + this.txtTel2.value + this.txtTel3.value, 10, 10 ); if ( sErrMsg != "" ) { ShowError ( "電話番号は合わせて" + sErrMsg, this.txtTel1 ); return false; } } /* End 統合名寄せ取込仕様変更対応で追加 */ }else if ( this.telType == C_TEL_NORMAL3 ) { // 普通の電話3(携帯電話チェック+電話番号0-0-0チェック) /* 378貸金業法4条(総量規制)対応 2010/02/19 円谷 START */ sErrMsg = clsChecker.CheckLength ( this.txtTel1.value + this.txtTel2.value + this.txtTel3.value, 9, 11 ); if ( sErrMsg != "" ) { ShowError ( "電話番号は合わせて" + sErrMsg, this.txtTel1 ); return false; } // 頭3桁 var sTelTop3 = (this.txtTel1.value + this.txtTel2.value + this.txtTel3.value).substr(0, 3); // ALL"0"の時はエラーとする if( (this.txtTel1.value + this.txtTel2.value + this.txtTel3.value) == "00000000000" || (this.txtTel1.value + this.txtTel2.value + this.txtTel3.value) == "0000000000" || (this.txtTel1.value + this.txtTel2.value + this.txtTel3.value) == "000000000" ) { ShowError ( "電話番号「" + this.txtTel1.value + "-" + this.txtTel2.value + "-" + this.txtTel3.value + "」は使用できません。", this.txtTel1 ); return false; } // 電話番号の頭3桁が(0x0)の場合は、11桁以外はエラーとする if( sTelTop3 == "010" || sTelTop3 == "020" || sTelTop3 == "030" || sTelTop3 == "040" || sTelTop3 == "050" || sTelTop3 == "060" || sTelTop3 == "070" || sTelTop3 == "080" || sTelTop3 == "090" || sTelTop3 == "000") { sErrMsg = clsChecker.CheckLength ( this.txtTel1.value + this.txtTel2.value + this.txtTel3.value, 11, 11 ); if ( sErrMsg != "" ) { ShowError ( "電話番号は合わせて" + sErrMsg, this.txtTel1 ); return false; } // 電話番号の頭3桁が(0x0)の場合は、電話番号1(入力欄の1つ目)が3桁以外はエラーとする if ( this.txtTel1.value.length != 3 ) { ShowError ( "電話番号は3桁-4桁-4桁の形式で入力して下さい。", this.txtTel1 ); return false; } } else { // 電話番号の頭3桁が(0x0)以外の場合は、10桁以外はエラーとする sErrMsg = clsChecker.CheckLength ( this.txtTel1.value + this.txtTel2.value + this.txtTel3.value, 10, 10 ); if ( sErrMsg != "" ) { ShowError ( "電話番号は合わせて" + sErrMsg, this.txtTel1 ); return false; } } /* 378貸金業法4条(総量規制)対応 2010/02/19 円谷 END */ } else if ( this.telType == C_TEL_MOBILE ) { // 携帯電話 // 携帯電話は3+4+4文字で固定 sErrMsg = clsChecker.CheckLength ( this.txtTel1.value, 3, 3 ); if ( sErrMsg != "" ) { ShowError ( this.sName1 + "は" + sErrMsg, this.txtTel1 ); return false; } sErrMsg = clsChecker.CheckLength ( this.txtTel2.value, 4, 4 ); if ( sErrMsg != "" ) { ShowError ( this.sName2 + "は" + sErrMsg, this.txtTel2 ); return false; } sErrMsg = clsChecker.CheckLength ( this.txtTel3.value, 4, 4 ); if ( sErrMsg != "" ) { ShowError ( this.sName3 + "は" + sErrMsg, this.txtTel3 ); return false; } } else if ( this.telType == C_TEL_MOBILE2 ) { // 携帯電話2(電話番号0-0-0チェック) /* 378貸金業法4条(総量規制)対応 2010/02/19 円谷 START */ // 携帯電話は3+4+4文字で固定 sErrMsg = clsChecker.CheckLength ( this.txtTel1.value, 3, 3 ); if ( sErrMsg != "" ) { ShowError ( this.sName1 + "は" + sErrMsg, this.txtTel1 ); return false; } sErrMsg = clsChecker.CheckLength ( this.txtTel2.value, 4, 4 ); if ( sErrMsg != "" ) { ShowError ( this.sName2 + "は" + sErrMsg, this.txtTel2 ); return false; } sErrMsg = clsChecker.CheckLength ( this.txtTel3.value, 4, 4 ); if ( sErrMsg != "" ) { ShowError ( this.sName3 + "は" + sErrMsg, this.txtTel3 ); return false; } // ALL"0"の時はエラーとする if( (this.txtTel1.value + this.txtTel2.value + this.txtTel3.value) == "00000000000" ) { ShowError ( "携帯電話番号「" + this.txtTel1.value + "-" + this.txtTel2.value + "-" + this.txtTel3.value + "」は使用できません。", this.txtTel1 ); return false; } /* 378貸金業法4条(総量規制)対応 2010/02/19 円谷 END */ } } return true; } // 値取得 this.GetValue = function() { return this.txtTel1.value + this.txtTel2.value + this.txtTel3.value; } } //************************************************** // Eメールクラス //************************************************** function UTLEMail( bHissu, txtAdd, maxLength, sName, txtAdd2, sName2 ) { this.bHissu = bHissu; this.txtAdd = txtAdd; this.maxLength = maxLength; this.sName = sName; this.txtAdd2 = txtAdd2; this.sName2 = sName2; this.Check = function() { if ( this.bHissu == true || this.txtAdd.value != "" || ( this.txtAdd2 != null && this.txtAdd2.value != "" ) ) { // NULLチェック if ( NullCheck ( this.txtAdd, this.sName ) == false ) return false; // 許容文字チェック var sSrc = this.txtAdd.value; for ( var i = 0; i < sSrc.length; i++ ) { if ( STRMail.indexOf( sSrc.charAt( i ), 0 ) < 0 ) { ShowError ( msg( WSN1038 ), this.txtAdd ); return false; } } // 桁数チェック var sErrMsg = CheckLength ( this.txtAdd.value, 0, this.maxLength, "字" ); if ( sErrMsg != "" ) { ShowError ( this.sName + "は" + sErrMsg, this.txtAdd ); return false; } // アドレス表現チェック if ( sSrc.match( /^\S+@\S+\.\S+$/ ) == null ) { ShowError ( msg( WSN1009 ), this.txtAdd ); return false; } // 確認アドレスチェック if ( this.txtAdd2 != null ) { if ( NullCheck ( this.txtAdd2, this.sName2 ) == false ) return false; if ( this.txtAdd.value != this.txtAdd2.value ) { ShowError ( msg( WSN1035 ), this.txtAdd ); return false; } } } return true; } // 値取得 this.GetValue = function() { return this.txtAdd.value; } } //************************************************** // 暗証番号クラス(単体チェック) //************************************************** function UTLPin( bHissu, txtPin1, minLength, maxLength, sName1 ) { this.bHissu = bHissu; this.txtPin1 = txtPin1; this.minLength = minLength; this.maxLength = maxLength; this.sName1 = sName1; this.Check = function() { if ( this.bHissu == true || this.txtPin1.value != "" ) { // NULLチェック if ( NullCheck ( this.txtPin1, this.sName1 ) == false ) return false; // チェッカークラス生成 var clsChecker = CheckerFactory ( C_TYPE_TEXT_NUMBER ); // 文字種別チェック if ( clsChecker.CheckType( this.txtPin1 ) == false ) return false; // 桁数チェック var sErrMsg = clsChecker.CheckLength ( this.txtPin1.value, this.minLength, this.maxLength ); if ( sErrMsg != "" ) { ShowError ( this.sName1 + "は" + sErrMsg, this.txtPin1 ); return false; } // 内容チェック if ( this.txtPin1.value == 0 ) { ShowError ( msg( WSN1016 ), this.txtPin1 ); return false; } else if ( this.txtPin1.value == 9999 ) { ShowError ( msg( WSN1065 ), this.txtPin1 ); return false; } } return true; } } //************************************************** // 暗証番号クラス(相関チェック1) //************************************************** function UTLPin2 ( oPin1, sPinName1, oPin2, sPinName2, sBirth, sBirthName, sTel, sTelName ) { this.oPin1 = oPin1; this.sPinName1 = sPinName1; this.oPin2 = oPin2; this.sPinName2 = sPinName2; this.sBirth = sBirth; this.sBirthName = sBirthName; this.sTel = sTel; this.sTelName = sTelName; this.Check = function() { // 確認用暗証番号チェック if ( this.oPin1.value != "" ){ if ( NullCheck ( this.oPin2, this.sPinName2 ) == false ) return false; if ( this.oPin2 != null ) { if ( this.oPin1.value != this.oPin2.value ) { ShowError ( msg( WSN1021 ), oPin1 ); return false; } } } // 属性PINチェック if ( this.sTel != null && this.sBirth != null ){ var Ret = -1; var sTelU4 = this.sTel.slice(-4); var sBirthMMDD = this.sBirth.substring(2); var sBirthWWMD = ""; var sBirthWWMM = this.sBirth.substring(0,4); var sBirthWWDD = this.sBirth.substring(0,2) + this.sBirth.substring(4); if(this.sBirth.charAt(2) == '0' && this.sBirth.charAt(4) == '0') { sBirthWWMD = this.sBirth.substring(0,2) + this.sBirth.charAt(3) + this.sBirth.charAt(5); } if(this.oPin1.value == sTelU4){ Ret = 1; } else if(this.oPin1.value == sBirthMMDD) { Ret = 2; } else if(this.oPin1.value == sBirthWWMD) { Ret = 3; } else if(this.oPin1.value == sBirthWWMM) { Ret = 4; } else if(this.oPin1.value == sBirthWWDD) { Ret = 5; } else { Ret = 0; } if( Ret != 0 ) { ShowError ( msg( WSN1063 ), oPin1 ); return false; } } return true; } } //************************************************** // 年月期間クラス //************************************************** function UTLYMTerm( bHissu, txtYear, txtMonth, sName ) { this.bHissu = bHissu; this.txtYear = txtYear; this.txtMonth = txtMonth; this.sName = sName; //this.sName1 = sName1; //this.sName2 = sName2; this.Check = function() { if ( this.bHissu == true || this.txtYear.value != "" || this.txtMonth.value != "" ) { // NULLチェック //if ( NullCheck ( this.txtYear, this.sName1 ) == false ) return false; //if ( NullCheck ( this.txtMonth, this.sName2 ) == false ) return false; // NULLチェック2 if ( NullCheck2 ( this.txtYear, this.txtMonth, this.sName ) == false ) return false; // チェッカークラス生成 clsChecker = CheckerFactory ( C_TYPE_TEXT_NUMBER ); // 文字種別チェック if ( clsChecker.CheckType( this.txtYear ) == false ) return false; if ( clsChecker.CheckType( this.txtMonth ) == false ) return false; // 内容チェック if ( this.txtYear.value < 0 || this.txtYear.value > 99 ) { ShowError ( msg( WSN1059 ), this.txtYear ); return false; } if ( this.txtMonth.value < 0 || this.txtMonth.value > 11 ) { ShowError ( msg( WSN1060 ), this.txtMonth ); return false; } if ( this.txtYear.value == 0 && this.txtMonth.value == 0 ) { ShowError ( msg( WSN1061 ), this.txtYear ); return false; } } return true; } } //************************************************** // 西暦クラス //************************************************** function UTLSeireki( bHissu, selNengo, selYear1, selYear2, selMonth, selDay, sNow, sName ) { this.bHissu = bHissu; this.selNengo = selNengo; this.selYear1 = selYear1; this.selYear2 = selYear2; this.selMonth = selMonth; this.selDay = selDay; this.sNow = sNow; this.sName = sName; // チェック関数 this.Check = function() { // NULLチェック if ( this.bHissu == true && NullCheck ( this.selNengo, this.sName ) == false ) return false; // 日付妥当性チェック var gengou = parseInt ( GetSelValue ( this.selNengo ) ); var y = parseInt ( GetSelValue ( this.selYear1 ) ) * 10 + parseInt ( GetSelValue ( this.selYear2 ) ); var m = parseInt ( GetSelValue ( this.selMonth ) ); var d = parseInt ( GetSelValue ( this.selDay ) ); var year = 0; var flag = true; if ( this.CheckDate( gengou, y, m, d ) == false ) { ShowError ( msg( WSN1017 ), this.selNengo ); return false; } return true; } // 日付の妥当性チェック this.CheckDate = function ( gengou, y, m, d ) { // 和暦→西暦 switch ( gengou ) { case 1: // 明治 if ( y < 1 || y > 45 ) return false; year = 1867 + y; if ( year == 1868 ) { if ( m < 9 || ( m == 9 && d < 8 ) ) return false; } if ( year == 1912 ) { if ( m > 7 || ( m == 7 && d > 29 ) ) return false; } break; case 2: // 大正 if ( y < 1 || y > 15 ) return false; year = 1911 + y; if ( year == 1912 ) { if ( m < 7 || ( m == 7 && d < 30 ) ) return false; } if (year == 1926){ if ( m == 12 && d > 24 ) return false; } break; case 3: // 昭和 if ( y < 1 || y > 64 ) return false; year = 1925 + y; if ( year == 1926 ) { if ( m < 12 || ( m == 12 && d < 25 ) ) return false; } if ( year == 1989 ) { if ( m > 1 || ( m == 1 && d > 7 ) ) return false; } break; case 4: // 平成 if ( y < 1 || y > 49 ) return false; year = 1988 + y; if ( year == 1989 ) { if ( m == 1 && d < 8 ) return false; } } var years = year; var months = m - 1; var days = d; var dates = new Date( years, months, days ); if ( years != dates.getFullYear() || months != dates.getMonth() || days != dates.getDate() ) return false; // 未来の日付入力対応 var nowYear = Number ( this.sNow.substring( 0, 4 ) ); var nowMon = Number ( this.sNow.substring( 4, 6 ) ); var nowDay = Number ( this.sNow.substring( 6, 8 ) ); if ( nowYear < year ) return false if ( nowYear == year ) { if ( nowMon < m ) return false if ( nowMon == m && nowDay < d) return false; } return true; } } //************************************************** // セレクトクラス //************************************************** function UTLSelect( bHissu, selObj, sName ) { this.bHissu = bHissu; this.selObj = selObj; this.sName = sName; // チェック関数 this.Check = function() { if ( this.selObj == null ) return null; // NULLチェック if ( this.bHissu == true && NullCheck( this.selObj, this.sName ) == false ) return false; } // 値取得 this.GetValue = function() { return this.selObj.options[ this.selObj.selectedIndex ].value; } } //************************************************** // ラジオボタンクラス //************************************************** function UTLRadio( bHissu, items, sName ) { this.bHissu = bHissu; this.items = items; this.sName = sName; // チェック関数 this.Check = function() { if ( bHissu == false ) return true; if ( this.items == null ) return null; if ( this.items.length == null ) return true; // NULLチェック var bErr = true; for ( var i = 0; i < this.items.length; i++ ) { if ( this.items[i].checked == true ) { bErr = false; break; } } if ( bHissu == true ) { if ( bErr == true ) { alert( this.sName + msg( WSN1062 ) ); this.items[0].focus(); return false; } } return true; } // 値取得 this.GetValue = function() { if ( this.items == null ) return null; if ( this.items.length == null ) return this.items.value; for ( var i = 0; i < this.items.length; i++ ) { if ( this.items[i].checked == true ) { return this.items[i].value; } } return null; } } //************************************************** // テキストクラス2 //************************************************** function UTLText2( bHissu, txtObj, type, minLength, maxLength, minValue, maxValue, sName ) { this.bHissu = bHissu; this.txtObj = txtObj; this.type = type; this.minLength = minLength; this.maxLength = maxLength; this.minValue = minValue; this.maxValue = maxValue; this.sName = sName; // チェック関数 this.Check = function() { if ( this.bHissu == true || this.txtObj.value != "" ) { // NULLチェック if ( NullCheck ( this.txtObj, this.sName ) == false ) return false; // チェッカークラス生成 var clsChecker = CheckerFactory ( this.type ); // 文字種別チェック if ( clsChecker.CheckType ( this.txtObj ) == false ) return false; // Lengthチェック var sErrMsg = clsChecker.CheckLength ( this.txtObj.value, this.minLength, this.maxLength ); if ( sErrMsg != "" ) { ShowError ( sName + "は" + sErrMsg, this.txtObj ); return false; } // 最大値・最小値チェック if ( ( parseInt(this.txtObj.value) < parseInt(this.minValue) ) || ( parseInt(this.txtObj.value) > parseInt(this.maxValue) ) ) { ShowError ( this.sName + "は" + this.minValue + "000円以上、" + this.maxValue + "000円以下で入力してください。" , this.txtObj ); return false; } } return true; } // 値取得 this.GetValue = function() { return this.txtObj.value; } } /****************************************************/ /*テキストフィールドの値を修正 */ /****************************************************/ function ValueModify( str ) { this.str = str; // 値の修正: 横線記号を長音に変換 this.modifyToTyoOn = function() { str = str.replace(String.fromCharCode(8722), "ー"); return str; } // 値の修正: 横線記号を全角マイナスに変換 this.modifyToZenkakuMinus = function() { str = str.replace(String.fromCharCode(8722), "−"); return str; } } // コンプライアンス対応 2006/03/31 南條 START //************************************************** // 年齢(西暦)クラス //************************************************** function UTLAgeSeireki( bHissu, selNengo, selYear1, selYear2, selMonth, selDay, sNow, LimitAge, sName ) { this.bHissu = bHissu; this.selNengo = selNengo; this.selYear1 = selYear1; this.selYear2 = selYear2; this.selMonth = selMonth; this.selDay = selDay; this.sNow = sNow; this.LimitAge = LimitAge; this.sName = sName; this.iAge = 0; // チェック関数 this.Check = function() { // NULLチェック if ( this.bHissu == true && NullCheck ( this.selNengo, this.sName ) == false ) return false; // 日付妥当性チェック var gengou = parseInt ( GetSelValue ( this.selNengo ) ); var y = parseInt ( GetSelValue ( this.selYear1 ) ) * 10 + parseInt ( GetSelValue ( this.selYear2 ) ); var m = parseInt ( GetSelValue ( this.selMonth ) ); var d = parseInt ( GetSelValue ( this.selDay ) ); var year = 0; // 日付チェック if ( this.CheckDate( gengou, y, m, d ) == false ) { ShowError ( msg( WSN1017 ), this.selNengo ); return false; } // 年齢チェック if ( this.CheckAge() == false ) { ShowError ( this.LimitAge + msg( WSN1068 ),this.selNengo); return false; } return true; } // 日付チェック this.CheckDate = function ( gengou, y, m, d ) { // 和暦→西暦 switch ( gengou ) { case 1: // 明治 if ( y < 1 || y > 45 ) return false; year = 1867 + y; if ( year == 1868 ) { if ( m < 9 || ( m == 9 && d < 8 ) ) return false; } if ( year == 1912 ) { if ( m > 7 || ( m == 7 && d > 29 ) ) return false; } break; case 2: // 大正 if ( y < 1 || y > 15 ) return false; year = 1911 + y; if ( year == 1912 ) { if ( m < 7 || ( m == 7 && d < 30 ) ) return false; } if (year == 1926){ if ( m == 12 && d > 24 ) return false; } break; case 3: // 昭和 if ( y < 1 || y > 64 ) return false; year = 1925 + y; if ( year == 1926 ) { if ( m < 12 || ( m == 12 && d < 25 ) ) return false; } if ( year == 1989 ) { if ( m > 1 || ( m == 1 && d > 7 ) ) return false; } break; case 4: // 平成 if ( y < 1 || y > 49 ) return false; year = 1988 + y; if ( year == 1989 ) { if ( m == 1 && d < 8 ) return false; } } var years = year; var months = m - 1; var days = d; var dates = new Date( years, months, days ); if ( years != dates.getFullYear() || months != dates.getMonth() || days != dates.getDate() ) return false; // 未来の日付入力対応 var nowYear = Number ( this.sNow.substring( 0, 4 ) ); var nowMon = Number ( this.sNow.substring( 4, 6 ) ); var nowDay = Number ( this.sNow.substring( 6, 8 ) ); if ( nowYear < year ) return false if ( nowYear == year ) { if ( nowMon < m ) return false if ( nowMon == m && nowDay < d) return false; } // 年齢計算 this.iAge = nowYear - years; if (nowMon < m ){ this.iAge = this.iAge - 1; } else if (nowMon == m && nowDay < d) { this.iAge = this.iAge - 1; } return true; } //年齢チェック this.CheckAge = function () { if ( this.iAge < this.LimitAge ) { return false; } return true; } } //************************************************** // 年齢クラス //************************************************** function UTLAge( bHissu, txtObj, type, LimitAge, sName) { this.bHissu = bHissu; this.txtObj = txtObj; this.type = type; this.LimitAge = LimitAge; this.sName = sName; // チェック関数 this.Check = function() { if ( this.bHissu == true || this.txtObj.value != "" ) { // NULLチェック if ( NullCheck ( this.txtObj, this.sName ) == false ) return false; // チェッカークラス生成 var clsChecker = CheckerFactory ( this.type ); // 文字種別チェック if ( clsChecker.CheckType ( this.txtObj ) == false ) return false; // Lengthチェック var sErrMsg = clsChecker.CheckLength ( this.txtObj.value, 0, 3 ); if ( sErrMsg != "" ) { ShowError ( sName + "は" + sErrMsg, this.txtObj ); return false; } // 年齢制限チェック if ( this.txtObj.value < this.LimitAge ) { ShowError ( this.LimitAge + msg( WSN1068 ),this.txtObj); return false; } } return true; } // 値取得 this.GetValue = function() { return this.txtObj.value; } } // コンプライアンス対応 2006/03/31 南條 END