-- Shaun Farrell <[email protected]> wrote
(on Thursday, 02 April 2009, 05:12 PM -0400):
> That worked. If I am working with dojo forms with custom decorators is
> there a different class I have to extend or does zend form decorator
> abstract work.
> 
> I am having problems with errors displaying the dojo validation and
> combobox elements with prepopulated data.   I am trying to use a
> custom decorator.

Use the DijitElement decorator instead of the ViewHelper decorator when
using dojo elements (and DijitForm for the form itself).


> On 4/1/09, Matthew Weier O'Phinney <[email protected]> wrote:
> > -- Shaun Farrell <[email protected]> wrote
> > (on Wednesday, 01 April 2009, 07:20 PM -0400):
> >> I am just starting to figure out Zend_Form_Decorators and have a question
> >> on
> >> the best way to have Multiple buttons on one line all surround in one
> >> <div></
> >> div>
> >>
> >> Here is what I have and it works but I am wondering is this the best way
> >> to do
> >> this?
> >
> > Group them in a DisplayGroup. :)
> >
> > Really -- that's what display groups are for. Have your buttons simply
> > do a ViewHelper decorator, and then have the display group do a
> > FormElements and HtmlTag decorator:
> >
> >     $form->addElement('submit', 'submit', array(
> >         'label' => 'Submit Button',
> >         'decorators' => array(
> >             'ViewHelper',
> >         ),
> >     ));
> >     $form->addElement('submit', 'cancel', array(
> >         'label' => 'Cancel Button',
> >         'decorators' => array(
> >             'ViewHelper',
> >         ),
> >     ));
> >     $form->addElement('submit', 'submit1', array(
> >         'label' => 'Submit One Button',
> >         'decorators' => array(
> >             'ViewHelper',
> >         ),
> >     ));
> >
> >     $form->addDisplayGroup(array('submit', 'cancel, 'submit1'),
> > 'submitButtons', array(
> >         'decorators' => array(
> >             'FormElements',
> >             array('HtmlTag', array('tag' => 'div', 'class' => 'element')),
> >         ),
> >     ));
> >
> > The above will create create the buttons one after another, and then
> > group them in a <div> with the class of "element".
> >
> >
> >> I have three decorators
> >>
> >> // adds the <div to the first button
> >> public $openButtonDecorators = array(
> >>         'ViewHelper',
> >>         array('HtmlTag', array('tag' => 'div', 'class' => 'element',
> >> 'openOnly'
> >> =>true))
> >>     );
> >>
> >> // just outputs a button no decorator
> >>     public $noButtonDecorators = array(
> >>        'ViewHelper',
> >>     );
> >>
> >> //closes the div on the last button.
> >>     public $closeButtonDecorators = array(
> >>         'ViewHelper',
> >>         array('HtmlTag', array('tag' => 'div', 'class' => 'element',
> >> 'closeOnly'=>true))
> >>     );
> >>
> >> Then I take the buttons and add the decorators to them.
> >>
> >>         $form->addElement('submit', 'submit', array(
> >>             'Name'=> 'Submit Button',
> >>             'decorators' => $this->openButtonDecorators,
> >>         ));
> >>         $form->addElement('reset', 'cancel', array(
> >>             'Name'=> 'Cancel Button',
> >>             'decorators' => $this->noButtonDecorators,
> >>         ));
> >>         $form->addElement('submit', 'submit1', array(
> >>             'Name'=> 'Submit One Button',
> >>             'decorators' => $this->closeButtonDecorators,
> >>         ));
> >>
> >>
> >> Is this the best way to do this?
> >
> > --
> > Matthew Weier O'Phinney
> > Software Architect      | [email protected]
> > Zend Framework          | http://framework.zend.com/
> >
> 
> -- 
> Sent from my mobile device
> 
> ---------------------------
> Shaun J. Farrell
> Washington, DC
> http://www.livinginthedistrict.com/
> http://www.kapustabrothers.com/
> 

-- 
Matthew Weier O'Phinney
Software Architect      | [email protected]
Zend Framework          | http://framework.zend.com/

Reply via email to