开发者

Axapta Validation Override Always Executes Twice

开发者 https://www.devze.com 2022-12-10 06:02 出处:网络
In most cases, validation methods I\'ve overridden execute twice each time the parent field is changed.Everything still works, but the InfoLog displays double messages every time.

In most cases, validation methods I've overridden execute twice each time the parent field is changed. Everything still works, but the InfoLog displays double messages every time.

Is there any way to prevent this?

Thanks

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) || (exlo开发者_如何学编程wValue >= 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;
}


Your description of the problem is not really clear. One can override the valite method on a form control, the validate method on a form datasource and the validatefield method on the table. That's my knowledge of version 3.0. And how do you mean the "parent field"? I presume the table field?

If I put info messages in each of these methods they only execute once when I modify a value. That's the case in 3.0. I don't know which version you're using.

Maybe you could be more precise about which validation method you're testing?

0

精彩评论

暂无评论...
验证码 换一张
取 消