public function configureFormToExcludeData($tag, array $elementNames)
    {
        $removeCallable = array($this, 'removeStringFromArray');
        $self = $this;
        $this->getEventManager()->attach(self::EVENT_CONFIGURE_FORM.$tag, function (Event $event) use ($elementNames, $self) {
            /* @var $form \Zend\Form\Form */
            $form = $event->getParam('form');
            $fieldsToValidate = array_keys($form->getElements());
            foreach ($elementNames as $elementToRemove) {
                $self->removeStringFromArray($fieldsToValidate, $elementToRemove);
            }
            $form->setValidationGroup($fieldsToValidate);
        });
    }
public function configureFormToExcludeData($tag, array $elementNames)
    {
        $removeCallable = array($this, 'removeStringFromArray');
        $self = $this;
        $this->getEventManager()->attach(self::EVENT_CONFIGURE_FORM.$tag, function (Event $event) use ($elementNames, $self) {
            /* @var $form \Zend\Form\Form */
            $form = $event->getParam('form');
            $fieldsToValidate = array_keys($form->getElements());
            foreach ($elementNames as $elementToRemove) {
                $self->removeStringFromArray($fieldsToValidate, $elementToRemove);
            }
            $form->setValidationGroup($fieldsToValidate);
        });
    }
public function configureFormToExcludeData ( $ tag , array $ elementNames ) { $ removeCallable = array ( $ this , 'removeStringFromArray' ) ; $ self = $ this ; $ this -> getEventManager ( ) -> attach ( self :: EVENT_CONFIGURE_FORM . $ tag , function ( Event $ event ) use ( $ elementNames , $ self ) { /* @var $form \Zend\Form\Form */ $ form = $ event -> getParam ( 'form' ) ; $ fieldsToValidate = array_keys ( $ form -> getElements ( ) ) ; foreach ( $ elementNames as $ elementToRemove ) { $ self -> removeStringFromArray ( $ fieldsToValidate , $ elementToRemove ) ; } $ form -> setValidationGroup ( $ fieldsToValidate ) ; } ) ; }
Removes some elements from being validated; best used for subforms
@param $tag
@param array $elementNames
Removes some elements from being validated ; best used for subforms