Divyesh Bhalodi
Divyesh Bhalodi

Reputation: 95

Zend framework form structure for wrap form element with html tag

Can anyone help me to make html like this in Zend framework?

<span class="btn btn-success fileinput-button">
      <i class="glyphicon glyphicon-plus"></i>
      <span>Add files...</span>
      <input type="file" name="files[]" multiple>
</span>

I am using this code but not get same like what I want

$photo = new Zend_Form_Element_File('photo');
    $photo->setLabel($this->_translate->_('pictures') . ':')
            ->addValidator('IsImage')
            ->addValidator('Size', false, 204800)
            ->addValidator('Extension', false, 'jpg,png,gif')
            ->setDestination($_SERVER['DOCUMENT_ROOT'] . '/uploads')
            ->setValueDisabled(true)
            ->setAttrib('multiple', 'multiple')
            ->setIsArray(true)
            ->removeDecorator('Label');

....
....
$this->addElements(array($photo));

Upvotes: 1

Views: 701

Answers (1)

Thom Wiggers
Thom Wiggers

Reputation: 7054

You could use Zend_Form_Decorator_HtmlTag or write your own decorator. There are two brief examples here but this site is a bit old - so be sure to also check the documentation of Zend Framework

Upvotes: 1

Related Questions