在大多数情况下,我已经重写验证方法执行两次父字段被改变各一次。一切仍然有效,但信息日志显示双消息的每一次。

有什么办法防止这种情况?

由于

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;
}
有帮助吗?

解决方案

您的问题的描述是不是真的清楚。一个可以覆盖表单控件,在一个形式的数据源的验证方法和桌子上的validatefield方法valite方法。这是我的3.0版本的知识。 怎么你的意思是“父字段”?我相信表字段?

如果我把信息消息中的每个的这些方法中,他们只有当我修改的值执行一次。这是在3.0的情况下。我不知道你正在使用的版本。

也许你可以更精确地了解哪些验证方法你测试?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top