1

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));

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

4 Comments

Yes I can get only wrap span like <span><input type="file" /></span> I want to add one span and icon tag in wrap span also
The website includes examples on how to add tags only before or after your form element - but you will probably be much better off writing your own decorator.
Actually I am fresher for Zend framework So.. Can you show me or guide me how to create decorator and where I can place in folder?
devzone.zend.com/1240/decorators-with-zend_form contains a lot of information to get started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.