Answer the question
In order to leave comments, you need to log in
How to disable single form field filter in Zend Framework 2 in controller?
Such situation.
I get the form for adding/editing a user from the service manager with an already installed filter, in which there is a password check. But this password is not needed when the user is being edited. Can I somehow disable field validation in the form filter in the controller?
In getServiceConfig module:
// ....
'UserCRUDFilter' => function($sm)
{
return new \Users\Form\UserCRUDFilter();
},
'UserCRUDForm' => function($sm, $param, $param1)
{
$form = new \Users\Form\UserCRUDForm();
$form->setInputFilter($sm->get('UserCRUDFilter'));
return $form;
},
// ....
$form = $this->getServiceLocator()->get('UserCRUDForm');
if ($user_id > 0 && $this->request->getPost('password') == '') {
$form->.... // Как-то получаю доступ к классу фильтра и убираю required у проверки пароля
}
$form->isValid();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question