-- Jay M. Keith <[EMAIL PROTECTED]> wrote
(on Monday, 28 January 2008, 10:15 AM -0600):
> I managed to get this working by extending the ViewHelper decorator,
> but I am also looking at the option that you mention Matthew. The
> most confusing aspect about the decorators for me, at the moment with
> the current approach is the difficulty in adding duplicates. The
> issue I'm having at the present could be resolved by adding another
> HtmlTag decorator, but isn't easily possible as you've mentioned. So
> far, I've been very satisfied with the design of Zend_Form, but I feel
> it is very important to provide more flexibility with regards to the
> decorators, as this will be an area that's is likely to be used/abused
> a lot by end-users.
I'll definitely be attempting to do the aliasing as suggested by Simon;
it adds little complexity to the internals, and almost no changes to the
public API. Watch for it in svn sometime this week; I'll notify the list
if I cannot implement it.
> Ultimately, seeing the ability to specify the order, and have
> duplicate decorators I feel would be additions with good merit, as
> well as providing the flexibility that many of us need.
Ordering is not hard to implement on the public API, but a bit more
difficult internally, as it requires a substantial change to the
internal storage, plus methodology for sorting, etc. I can see a reason
for it, I'm just not sure it the case is strong enough to implement it.
> Thank you very much for your hard work Matthew and crew, this is an
> aspect of the Framework I've most been looking forward to in my
> current applications.
>
> Regards,
> Jay M. Keith
>
> On Jan 28, 2008 9:25 AM, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
> > -- Jay M. Keith <[EMAIL PROTECTED]> wrote
> > (on Saturday, 26 January 2008, 09:55 AM -0600):
> > > I've been messing around with Zend_Form and I'm happy thus far.
> > > But, I'm having an issue with what I think should be an easy task.
> > > I like the current rendering in dl's.. But I'm trying to add a div or
> > > span immediately after the <input> tag to be a field note/description.
> >
> > There are two issues here: one has to do with a limitation of how
> > decorators are registered, the other with ordering of decorators.
> >
> > Currently, there's a limitation that you can only use one decorator of a
> > given type. Simon Mundy has proposed a solution that involves aliasing
> > that I will likely implement in the next day or two. In the meantime,
> > you should likely create a custom decorator.
> >
> > Regarding the second issue, decorators are processed in the order in
> > which they are registered. Right now, that order is:
> >
> > * ViewHelper (to create the input)
> > * Errors (creates error HTML and appends to input)
> > * HtmlTag (wraps content in <dd> -- which at this point includes input
> > element and errors)
> > * Label (creates label in a <dt> and prepends to content)
> >
> > So, if you want to append something after the input, within the <dd>
> > tag, you will need to register a new decorator chain. Let's assume you
> > create a 'FormHint' decorator; you could then register them like this:
> >
> > $element->setDecorators(array(
> > array('decorator' => 'ViewHelper', 'options' => array('helper' =>
> > 'xxx'),
> > array('decorator' => 'FormHint'),
> > array('decorator' => 'Errors'),
> > array('decorator' => 'HtmlTag', 'options' => array('tag' => 'dd'),
> > array('decorator' => 'Label', 'options' => array('tag' => 'dt'),
> > ));
> >
> > (You could also do this at the form level using setElementDecorators().)
> >
> > I can see an argument for being able to specify the order of decorators,
> > but it's so simple to register them, I'm not sure if it makes sense to
> > complicate the API or the implementation for the small convenience.
> >
> >
> > > Here's my desired result:
> > >
> > > <dt><label for="username">Username</label></dt>
> > > <dd><input type="text" name="username" id="username" value="" /><div
> > > class="form-note"> Minimum of 4 characters, Maximum of 32
> > > characters.</div></dd>
> > >
> > > I've been trying a variety of different methods including using my own
> > > decorators. For some reason I imagined that a simple modification
> > > like this would be a bit easier to do.
> > > Any recommendations? I started writing up another decorator to be a
> > > Hint/Desc/Note area, but wanted to see if there was a different
> > > approach.
> > >
> > > Regards,
> > > Jay M. Keith
> > >
> >
> > --
> > Matthew Weier O'Phinney
> > PHP Developer | [EMAIL PROTECTED]
> > Zend - The PHP Company | http://www.zend.com/
> >
>
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/