![]() |
|
|||
|
Hi All,
I am new to Zend Framework and trying to design UI using Zend_Forms. What I need to do is to switch between 2 divs using javascript. One div will have e.g First Name and Surname and other will have company name. I will switch between these divs depending on Individual and company selection. I tried to use used the following code: $first_name = new Zend_Form_Element_Text('first_name'); $first_name ->setRequired(true) ->addValidator(new Zend_Validate_Alnum()) ->addFilter('StringToLower') ->setLabel('First Name'); $surname = new Zend_Form_Element_Text('surname'); $surname ->setRequired(true) ->addValidator(new Zend_Validate_Alnum()) ->addFilter('StringToLower') ->setLabel('Surname'); $form->addElement( $first_name ); $form->addElement( $surname ); $form->addDisplayGroup(array('first_name','surname'), 'individual'); $form->setDisplayGroupDecorators( array( 'FormElements', array('HtmlTag', 'tag' => 'div') ) ); The problem I am having is that I get the div properly working but I don't get the id for the div. So I am not able to manipulate using javascript. Also I don't know how to hide or unhide the div using zend_form. Can somebody give me guidance on how to make div properly working using Zend_Forms? |
|
|||
|
Zend Form display groups and decorators with example Zend Framework Weblog appears to have the answer.
Code:
$form->addElement( $first_name );
$form->addElement( $surname );
$form->addDisplayGroup(array('first_name','surname'), 'individual');
$form->setDecorators(array(
'FormElements',
array('HtmlTag',array('tag'=>'div','id'=>'blah')),
'individual'
));
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| Designed by: Miner Skinz |
Powered by vBulletin® Version 3.8.4 Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.1.0 |
![]() |