开发者

Disable Zend Form Element validation if hidden

开发者 https://www.devze.com 2023-04-08 11:46 出处:网络
I have a few elements in my zend form that are sometime hidden via javascript. I would like to disable their validations if they are hidden, so the form will be valid.

I have a few elements in my zend form that are sometime hidden via javascript.

I would like to disable their validations if they are hidden, so the form will be valid.

Any way to do it in the server side? or 开发者_开发问答in the element settings?

Thanks.


Depending on the situation, you could at the same time disable the hidden items. Thus they won't be posted and you could then use isValidPartial that only validates the fields that are send in parameter.


I think you might need to remove the validators for the hidden fields (by calling clearValidators()) before calling isValid().

There is a similar question here: Zend form validation . You might get some inspiration from the answers.

Hope it helps,

0

精彩评论

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