Disable notInArray Validator Zend Framework 2

后端 未结 5 2394
醉梦人生
醉梦人生 2021-02-20 12:36

Is there a way to disable notInArray Validator in Zend Framework 2. All the info on the internet shows how to disable the notInArray Validator in Zend Framework 1, for example i

5条回答
  •  悲哀的现实
    2021-02-20 12:45

    I came with the same case : while i was populating my html select element via ajax after alot of searching found no way to do it , ending with creating my own select form element , I will provide you with my changes :

        /**
         * Provide default input rules for this element
         *
         * Attaches the captcha as a validator.
         *
         * @return array
         */
        public function getInputSpecification()
        {
            $spec = array(
                'name' => $this->getName(),
                'required' => true,
                //// make sure to delete the validators array in the next line  
                'validators' => array( 
                    $this->getValidator()
                )
            );
    
            return $spec;
        }
    

提交回复
热议问题