Zend 表单验证

我正在使用 Zend Form 创建动态表单.

I am using Zend Form to create dynamic form.

我也有 Zend Form 验证.

I have Zend Form validation too.

尝试动态删除验证,但没有任何成功.

Trying to remove Validation dynamically, but not getting any success.

你能帮我删除 Zend 验证吗.

Can you plz help me to remove Zend Validation.

Bellow 是我的删除验证代码:

Bellow is my code for remove validation :

$toRemValArray = array();
$toRemValArray[0] = 'ele_4af42ceac7810';

if(isset($_POST['btnPost_x'])){                 
    if ($form->isValid($_POST)) {
        $allElements = $form->getElements();
        foreach($allElements as $val){
            if(in_array('ele_4af42ceac7810',$toRemValArray)){
                $value = $form->getElement($val->getName());
                $value->removeValidator('ele_4af42ceac7810');
            }
        }
    }
}

让我知道我的代码是否有任何问题

Let me know whether my code is having any issue

谢谢穆罕默德·塔雷克

推荐答案

您应该删除调用 $form->isValid() 的验证器BEFORE.

You should remove the validator BEFORE calling $form->isValid().

相关文章