Giter Site home page Giter Site logo

【メール】 Eメールフィールドのグループ名とフィールド名が同じ場合のエラー文の表示がおかしい about basercms HOT 4 OPEN

baserproject avatar baserproject commented on August 22, 2024
【メール】 Eメールフィールドのグループ名とフィールド名が同じ場合のエラー文の表示がおかしい

from basercms.

Comments (4)

tnagatomi avatar tnagatomi commented on August 22, 2024

投稿者: 加藤 朗
投稿日: 2018/07/27 00:53:01

加藤追記

設定を調整して、エラーメッセージを正常にしても、Eメールフィールドの比較チェックの際に、エラーメッセージの出方がおかしくなる例□メールアドレスフィールド名: email_1グループ名: グループ入力チェック: email




□確認用メールアドレスフィールド名: email_2グループ名: emailグループ入力チェック: email




email_2にメールアドレスを入れ email_1を空のままにするとemail_2に「必須項目です。」と出る(email_1 に「必須項目です。」と出るのが正しい)




email_1にメールアドレスを入れ email_2に a と入れるとemail_2に「入力データが一致していません。」と出るが、email_1に「形式が無効です。」と出る(email_1には何も出ない、もしくは「入力データが一致していません。」と出て、email_2に「形式が無効です。」「入力データが一致していません。」が出るのが正しい)

from basercms.

tnagatomi avatar tnagatomi commented on August 22, 2024

投稿者: 加藤 朗
投稿日: 2018/07/27 04:22:25

E-mail比較チェックにチェックを入れると・入力必須・E-Mail形式の判定の判定まで、E-mail比較チェックで行い、グループの一番最後に表示しようとするのでおかしな場所にエラーメッセージが出力されてしまう。

機能を切り分ける必要があります。・入力必須・E-Mail形式の判定はそれぞれのフィールドで判定し、一致するかどうかの判定だけをE-mail比較チェックで行う必要があります。




下記のようなコードでビュー側(mail_input.php)からE-mail比較チェックで行ってしまう余計な処理を消し、フィールドごとの処理を出力してやるようにすることで、一時対応は可能

// email比較チェックでは何故か「必須項目です」が表示されないので追記」
if($this->data['MailMessage'][$field['field_name']] == "") {
echo $this->Mailform->error("MailMessage." . $field['field_name'] , __("必須項目です。"));
} else {
// 必須以外のメッセージも表示
echo $this->Mailform->error("MailMessage." . $field['field_name']);
}

/* 説明欄 */
if (($this->BcArray->last($mailFields, $key)) ||
($field['group_field'] != $mailFields[$next_key]['MailField']['group_field']) ||
(!$field['group_field'] && !$mailFields[$next_key]['MailField']['group_field']) ||
($field['group_field'] != $mailFields[$next_key]['MailField']['group_field'] && $this->BcArray->first($mailFields, $key))) {

if ($field['group_valid']) {
    // email比較チェックは'group_field'ではなく'group_valid'
    echo $this->Mailform->error("MailMessage." . $field['group_valid'] . "_not_same", __("入力データが一致していません。"));
    echo $this->Mailform->error("MailMessage." . $field['group_field'] . "_not_complate", __("入力データが不完全です。"));

    if (!$this->Mailform->error("MailMessage." . $field['group_field'] . "_not_same")
        && !$this->Mailform->error("MailMessage." . $field['group_field'] . "_not_complate")) {
        $groupValidErrors = $this->Mailform->getGroupValidErrors($mailFields, $field['group_valid']);
        if ($groupValidErrors) {
            foreach ($groupValidErrors as $groupValidError) {
                // email比較チェックではグループ全体でメール形式のチェックを行う必要はない
                echo $groupValidError == '<div class="error-message">形式が無効です。</div>' ? '':$groupValidError;
            }
        //必須判定は個別に行うので、'group_valid'の処理はここまで
        } else {
            if(!$field['group_valid']){
                echo $this->Mailform->error("MailMessage." . $field['group_field'], __("必須項目です。"));
            }
        }
    }
}

echo '</span>';
echo "</td>\n    </tr>\n";

} else {
echo '';
}

from basercms.

tnagatomi avatar tnagatomi commented on August 22, 2024

投稿者: 加藤 朗
投稿日: 2018/07/27 05:26:16

問題を切り分けるため、Eメールフィールドの比較チェックの際に、エラーメッセージの出方がおかしくなる問題は別チケットに移しました。http://project.e-catchup.jp/issues/22093

from basercms.

kaburk avatar kaburk commented on August 22, 2024

baserCMS4.4.8でもこちらの問題を再現可能でした

スクリーンショット 2021-07-28 16 17 34

from basercms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.