how to disable inArray validator forms in zend framework2

前端 未结 3 1573
庸人自扰
庸人自扰 2021-01-06 04:44

i use this in my Form:

$this->add(array(     
    \'type\' => \'Zend\\Form\\Element\\Select\',       
    \'name\' => \'county\',
    \'registerInAr         


        
相关标签:
3条回答
  • 2021-01-06 05:26

    In https://github.com/zendframework/zf2/blob/master/library/Zend/Form/Element/Select.php there is an option $disableInArrayValidator = false; and the corresponding method here

    0 讨论(0)
  • 2021-01-06 05:39

    In ZF1, this is what works:

    // using the element instance:
    $element->setRegisterInArrayValidator(false);
    
    // or a configuration key as part of the options array:
    'registerInArrayValidator' => false
    
    // or
    element.options.registerInArrayValidator = false
    
    0 讨论(0)
  • 2021-01-06 05:41

    Add the disable_inarray_validator to the options:

    $this->add(array(
        ...
        'options' => array(
            'disable_inarray_validator' => true,
            'label' => 'county',
        ),
    ));
    
    0 讨论(0)
提交回复
热议问题