0

ほとんどの場合、オーバーライドした検証メソッドは、親フィールドが変更されるたびに2回実行されます。すべては引き続き機能しますが、InfoLogは毎回二重のメッセージを表示します。

これを防ぐ方法はありますか?

ありがとう

public boolean validate()
{
    boolean ret;
    int exlowValue;
    int lowValue;
    int highValue;
    int exhighValue;
    str errorMessage;
    ;

    ret = super();

    //Make sure a numeric value was entered
    if (ABC_RegExValidator::validateMe("integer",  int2str    (ABC_Checks_checkExtremeLow.value())))
    {
        //get the form values
        exlowValue = ABC_Checks_checkExtremeLow.value();
        lowValue = str2int(ABC_Checks_checkLow.valueStr());
        highValue = str2int(ABC_Checks_checkHigh.valueStr());
        exhighValue = str2int(ABC_Checks_checkExtremeHigh.valueStr());

        //Extreme Low must be 0 or less than all others
        if (exlowValue != 0)
        {
            //A non-zero value was entered; it must be less than all other fields
            if ((exlowValue >= lowValue && lowValue > 0) || (exlowValue >= highValue && highValue > 0) || (exlowValue >= exhighValue && exhighValue > 0))
            {
                //Return an error
                ret = checkfailed(strFmt("@ABC197", int2str(exlowValue)));
            }
            else
            {
                //Not greater than any other value
                //Success!
                ret = true;
            } //Greater than all others?
        }
        else
        {
            //No errors
            ret = true;
        } // 0?
    }
    else
    {
        //Regular expression failed
        //Return an error
        ret = checkfailed("@ABC192");
    } //Regular expression


    return ret;
}
4

1 に答える 1

0

問題の説明はあまり明確ではありません。フォーム コントロールの valite メソッド、フォーム データソースの validate メソッド、およびテーブルの validatefield メソッドをオーバーライドできます。それがバージョン 3.0 に関する私の知識です。そして、「親フィールド」とはどういう意味ですか? テーブルフィールドだと思いますか?

これらの各メソッドに情報メッセージを入れると、値を変更したときに一度だけ実行されます。3.0でもそうです。使用しているバージョンがわかりません。

テストしている検証方法について、より正確になる可能性がありますか?

于 2009-11-07T19:17:11.100 に答える