Issues

ZF-6691: Zend_Form_Element: Allow hyphen in element names / Manually set label's decorator ID

Issue Type: Improvement Created: 2009-05-16T18:15:36.000+0000 Last Updated: 2009-05-17T20:11:40.000+0000 Status: Resolved Fix version(s): Reporter: Eugene Song (bakadesu) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Form

Related issues: Attachments:

Description

Could we allow hyphen (-) in the charset in Zend_Form_Element's filterName() function?

Or have the ability to manually set the ID of the label's HtmlTag's Decorator? It currently relies on the element's name:

<pre class="highlight">
// Zend_Form_Decorator_Label
// render()
        if (null !== $tag) {
            require_once 'Zend/Form/Decorator/HtmlTag.php';
            $decorator = new Zend_Form_Decorator_HtmlTag();
            $decorator->setOptions(array('tag' => $tag,
                                         'id'  => $this->getElement()->getName() . '-label'));

            $label = $decorator->render($label);
        }

May be overkill, but I want to prepend the form's id to all the element, dt, and dd ids.

Trying to achieve the following:

<pre class="highlight">
Email Address

But does this instead:

<pre class="highlight">
Email Address

I haven't had much luck with an easy work around for the label's ID. Any suggestions other than using custom decorators?

Comments

Posted by Matthew Weier O'Phinney (matthew) on 2009-05-17T20:11:30.000+0000

hyphens are not allowed in element names as element names may only be valid PHP variable names in order to allow overloading. We may review this decision in the future, but for now, that decision stands.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts