Re: [fw-general] Zend Form Grouping Elements
have the same error message Message: Plugin by name 'DivWrapper' was not found in the registry; used paths: ZendX_JQuery_Form_Decorator_: ZendX/JQuery/Form/Decorator/ Zend_Form_Decorator_: Zend/Form/Decorator/ it's not searching in the direcotory which i add with addelementprefixpath. has anyone a solution for this? vladimirn wrote: Hello Mathew, I tried this, but wont work for me. $form-addDisplayGroupPrefixPath('forms_Decorator', 'forms/Decorator'); . $form-addDisplayGroup(array('username', 'password'), 'login', array( 'legend' = 'Please Login:', 'decorators' = array( 'FormElements', array('DivWrapper', array( 'labelFor' = 'login', 'labelClass' = 'required left optional', )) ), .. and i have application/forms/Decorator/ with DivWrapper.php in it. in bootstrap: $base = realpath(dirname(__FILE__) . '/../'); $paths = array( '.', $base . '/library', $base . '/application', $base . '/application/forms', $base . '/application/models', ); ini_set('include_path', implode(PATH_SEPARATOR, $paths)); Error i am getting: exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name DivWrapper was not found in the registry.' in Any suggestion? Thanks Vladimir Matthew Weier O'Phinney-3 wrote: What did you try? :) Here's what I'd try: you'll need to create a custom decorator for the display group, which I'll detail below, and then the following element/group definitions. $form-addDisplayGroupPrefixPath('My_Form_Decorator', 'My/Form/Decorator'); $form-addElement('text', 'txtZipcode', array( 'size' = 10, 'maxlength' = 10, 'class' = 'true', 'required' = 'true', 'decorators' = array('ViewHelper'), )); $form-addElement('text', 'txtCity', array( 'size' = 30, 'maxlength' = 20, 'class' = 'true', 'required' = 'true', 'decorators' = array('ViewHelper'), )); $form-addDisplayGroup(array('txtZipcode', 'txtCity'), 'zipCity', array( 'legend' = 'Zipcode/City', 'decorators' = array( 'FormElements', array('DivWrapper', array( 'labelFor' = 'txtZipcode', 'labelClass' = 'required left optional', )) ), )); The DivWrapper decorator would look like this: My_Form_Decorator_DivWrapper extends Zend_Form_Decorator_Abstract() { public function render($content) { $group = $this-getElement(); if (null === $group) { return $content; } $labelFor = $this-getOption('labelFor'); $labelClass = $this-getOption('labelClass'); $label = $group-getLegend(); $html =EOH div class=row label for=$labelFor class=$labelClass$label/label div class=element $content /div /div EOH; return $html; } } Put the above in My/Form/Decorator/DivWrapper.php on your include path, and you should be set. I think this is a common problem. So hopefully some can give me a hint how my decorator needs to look like... -- Matthew Weier O'Phinney Software Architect | matt...@zend.com Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Zend-Form-Grouping-Elements-tp18890779p25028079.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend Form Grouping Elements
Hello Mathew, I tried this, but wont work for me. $form-addDisplayGroupPrefixPath('forms_Decorator', 'forms/Decorator'); . $form-addDisplayGroup(array('username', 'password'), 'login', array( 'legend' = 'Please Login:', 'decorators' = array( 'FormElements', array('DivWrapper', array( 'labelFor' = 'login', 'labelClass' = 'required left optional', )) ), .. and i have application/forms/Decorator/ with DivWrapper.php in it. in bootstrap: $base = realpath(dirname(__FILE__) . '/../'); $paths = array( '.', $base . '/library', $base . '/application', $base . '/application/forms', $base . '/application/models', ); ini_set('include_path', implode(PATH_SEPARATOR, $paths)); Error i am getting: exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name DivWrapper was not found in the registry.' in Any suggestion? Thanks Vladimir Matthew Weier O'Phinney-3 wrote: What did you try? :) Here's what I'd try: you'll need to create a custom decorator for the display group, which I'll detail below, and then the following element/group definitions. $form-addDisplayGroupPrefixPath('My_Form_Decorator', 'My/Form/Decorator'); $form-addElement('text', 'txtZipcode', array( 'size' = 10, 'maxlength' = 10, 'class' = 'true', 'required' = 'true', 'decorators' = array('ViewHelper'), )); $form-addElement('text', 'txtCity', array( 'size' = 30, 'maxlength' = 20, 'class' = 'true', 'required' = 'true', 'decorators' = array('ViewHelper'), )); $form-addDisplayGroup(array('txtZipcode', 'txtCity'), 'zipCity', array( 'legend' = 'Zipcode/City', 'decorators' = array( 'FormElements', array('DivWrapper', array( 'labelFor' = 'txtZipcode', 'labelClass' = 'required left optional', )) ), )); The DivWrapper decorator would look like this: My_Form_Decorator_DivWrapper extends Zend_Form_Decorator_Abstract() { public function render($content) { $group = $this-getElement(); if (null === $group) { return $content; } $labelFor = $this-getOption('labelFor'); $labelClass = $this-getOption('labelClass'); $label = $group-getLegend(); $html =EOH div class=row label for=$labelFor class=$labelClass$label/label div class=element $content /div /div EOH; return $html; } } Put the above in My/Form/Decorator/DivWrapper.php on your include path, and you should be set. I think this is a common problem. So hopefully some can give me a hint how my decorator needs to look like... -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Zend-Form-Grouping-Elements-tp18890779p19439080.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend Form Grouping Elements
Hello, I have an element decorator for my elements and it is working corrent. It looks like this: public $elementDecorators = array( 'ViewHelper', 'MyErrors', array(array('data' = 'HtmlTag'), array('tag' = 'div', 'class' = 'element')), array('Label', array('class' = 'left')), array(array('row' = 'HtmlTag'), array('tag' = 'div', 'class' = 'row')), ); This renders code like this: div class=row label for=txtUserName class=required left optionalName/label div class=element input type=text name=txtUserName id=txtUserName value= size=30 maxlength=20 class=required / /div /div This is what I need :-) But now my problem. Sometime I want to have two or more elements in one row. Like perhaps zipcode and city. This should be rendered like this: div class=row label for=txtZipcode class=required left optionalZipcode/City/label div class=element input type=text name=txtZipcode id=txtZipcode value= size=10 maxlength=10 class=required / input type=text name=txtCity id=txtCity value= size=30 maxlength=20 class=required / /div /div I think, that I need to use DisplayGroups to achieve this. But I don't get it to work :-( I think this is a common problem. So hopefully some can give me a hint how my decorator needs to look like... Thanks for your Help, Stefan Sturm
Re: [fw-general] Zend Form Grouping Elements
-- Stefan Sturm [EMAIL PROTECTED] wrote (on Friday, 08 August 2008, 02:12 PM +0200): I have an element decorator for my elements and it is working corrent. It looks like this: public $elementDecorators = array( 'ViewHelper', 'MyErrors', array(array('data' = 'HtmlTag'), array('tag' = 'div', 'class' = 'element')), array('Label', array('class' = 'left')), array(array('row' = 'HtmlTag'), array('tag' = 'div', 'class' = 'row')), ); This renders code like this: div class=row label for=txtUserName class=required left optionalName/label div class=element input type=text name=txtUserName id=txtUserName value= size=30 maxlength=20 class=required / /div /div This is what I need :-) But now my problem. Sometime I want to have two or more elements in one row. Like perhaps zipcode and city. This should be rendered like this: div class=row label for=txtZipcode class=required left optionalZipcode/City/label div class=element input type=text name=txtZipcode id=txtZipcode value= size=10 maxlength=10 class=required / input type=text name=txtCity id=txtCity value= size=30 maxlength=20 class=required / /div /div I think, that I need to use DisplayGroups to achieve this. But I don't get it to work :-( What did you try? :) Here's what I'd try: you'll need to create a custom decorator for the display group, which I'll detail below, and then the following element/group definitions. $form-addDisplayGroupPrefixPath('My_Form_Decorator', 'My/Form/Decorator'); $form-addElement('text', 'txtZipcode', array( 'size' = 10, 'maxlength' = 10, 'class' = 'true', 'required' = 'true', 'decorators' = array('ViewHelper'), )); $form-addElement('text', 'txtCity', array( 'size' = 30, 'maxlength' = 20, 'class' = 'true', 'required' = 'true', 'decorators' = array('ViewHelper'), )); $form-addDisplayGroup(array('txtZipcode', 'txtCity'), 'zipCity', array( 'legend' = 'Zipcode/City', 'decorators' = array( 'FormElements', array('DivWrapper', array( 'labelFor' = 'txtZipcode', 'labelClass' = 'required left optional', )) ), )); The DivWrapper decorator would look like this: My_Form_Decorator_DivWrapper extends Zend_Form_Decorator_Abstract() { public function render($content) { $group = $this-getElement(); if (null === $group) { return $content; } $labelFor = $this-getOption('labelFor'); $labelClass = $this-getOption('labelClass'); $label = $group-getLegend(); $html =EOH div class=row label for=$labelFor class=$labelClass$label/label div class=element $content /div /div EOH; return $html; } } Put the above in My/Form/Decorator/DivWrapper.php on your include path, and you should be set. I think this is a common problem. So hopefully some can give me a hint how my decorator needs to look like... -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/