Zend Framework Source Code Snippets

Add html or text as form element

Bookmark and Share
1
2
3
4
56
7
8
9
1011
12
13
14
1516
17
<?php
 
/**
 * Form note element
 * * @author Ruslan Zavackiy <ruslan.zavackiy@gmail.com>
 * @package elements
 */
 
/** * Loads helper Zend_View_Helper_FormNote
 */
 
class Custom_Form_Element_Note extends Zend_Form_Element_Xhtml
{    public $helper = 'formNote';
}
1
2
3
4
5
Then in elemens definition write:
 
$companies->addElement('note', 'companyNote', array(
            'value' => '<a href="javascript:;" id="addCompany">Add Company</a>'
        ));

Comments

ami ami
1 year ago

This element is not display when form is not valid !

ami ami
6 months ago

solution : http://framework.zend.com/wiki/display/ZFFAQ/Forms :: How can I add extra HTML (such as a link) to my form element?

You must login before commenting on a snippet. If you do not have an account, please register.

Snippet description

With this element you can simply add html or any other text to the forms and then add to them functionality with javascript. For example in my case I created this to add more companies dynamicaly.

Snippet details

Created:
Ruslan Zavackiy Ruslan Zavackiy
1 year ago
Edited:
Ruslan Zavackiy Ruslan Zavackiy
1 year ago
Revision Id:
82
Edit Message:
Initial Release
Tags:
custom form element note
Comments:
2
Views:
461
Points:
0 (2 votes)

History

r82

Initial Release

Ruslan Zavackiy Ruslan Zavackiy
1 year ago
diff
r81

Initial Release

Ruslan Zavackiy Ruslan Zavackiy
1 year ago