English 中文(简体)
• 在两个领域之间需要一个领域时如何验证被冻结的形式
原标题:how to validate zend form where at one field in required between two fields

我有两个因素,即成人和没有孩子,至少需要一个领域。 如何在冻结的框架中证实这一点并产生错误信息。

最佳回答

你们需要创造 您自己的有效者。 在这种情形下,我认为你可以使用Zentd_Validate_I Equal,复制其代码和变式方法,如:

public function isValid($value, $context = null)
{
    $this->_setValue((string) $value);

    if (($context !== null) && isset($context) && array_key_exists($this->getToken(), $context)) {
        $token = $context[$this->getToken()];
    } else {
        $token = $this->getToken();
    }

    if ($token === null) {
        $this->_error(self::MISSING_TOKEN);
        return false;
    }

    $strict = $this->getStrict();
    // change != to ==
    if (($strict && ($value === $token)) || (!$strict && ($value == $token)) && (&token ==   || $value ==   ) {
        $this->_error(self::**YOUR_ERROR _CODE**);
        return false;
    }

    return true;
}

该守则没有经过测试,但应当做到:

问题回答

暂无回答




相关问题
Zend 邮件问题,涉及外国char子+ com子

泽斯德邮局在名称被定为具有外国性质(如“保”)和 com(”)的物品时,就放弃了一种例外(因为邮局(邮局)退回假)。 重新提出以下守则。

PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

Link to a specific step in onepage checkout

Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...

Tagging with Zend Framework

I m trying to create the same solutions as below, but using a simple MySQL query (instead of the static version used below where the words/tags are implemented in the code). The name of the MySQL ...

dynamicaly adding textboxes to zend_form

I hope that this is a quick question to answer. I am developing a form using Zend_Form, I have a number of Zend_Dojo_Form_Element_Textboxs to add to this form dynamically. These are added from rows ...

热门标签