Add class attribute to Form Errors

后端 未结 6 1988
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 09:15

I´m developing an application using Zend Framework 2 and I use FormRow helper to render a label, the input and errors (if present) in a Form.



        
6条回答
  •  一生所求
    2020-12-29 09:29

    I use echo $this->formElementErrors($form, array('class' => "error-messages")); to show all error messages in one place:

    echo $this->formElementErrors($form, array('class' => "error-messages"));// Print all error messagess
    
    echo $this->formLabel($form->get('Name'));
    echo $this->formInput($form->get('Name'));
    
    echo $this->formLabel($form->get('Name2'));
    echo $this->formInput($form->get('Name2'));
    

提交回复
热议问题