/** * 団体情報(パスワード初期化)フォーム */ class WpGroupInfoPasswdInitJsForm { /** * コンストラクタ */ constructor() { /** メールアドレス */ this.mail_address = ""; // コントロールクリア this.setControlStyle("mail_address", "border: 1px solid #ccc;"); } /** * フォームデータを設定 */ setFormData() { var elm_mail_address = document.getElementById('vol_form').mail_address; if (elm_mail_address != null) { this.mail_address = elm_mail_address.value; } } /** * バリデーション */ validate() { let errInfo = []; // 必須チェック if (this.mail_address == "") { errInfo.push(["mail_address", "メールアドレスを入力してください。"]); } // 桁数チェック if (errInfo.length == 0) { if (this.mail_address.length > 256) { errInfo.push(["mail_address", "メールアドレスの文字数が大きすぎます。"]); } } // 入力形式チェック if (errInfo.length == 0) { } // 範囲チェック if (errInfo.length == 0) { } // 相関チェック if (errInfo.length == 0) { } // エラー情報設定 errInfo.forEach(function(err) { this.setControlStyle(err[0], "border: 1px solid red;"); }, this); return errInfo; } /** * コントロールにスタイルを適用する */ setControlStyle(ctrlName, style) { let ctrls = document.getElementsByName(ctrlName); ctrls.forEach(function(ctrl) { ctrl.style = style; }); } }