The preg replace is there to also address names with brackets. So subfrm[0] with value true would be converted to subfrm-0-true. It was copied from Zend_Form_Decorator_ViewHelper, so i think it's safe, but didn't create it.

Comments

Posted by jaap vstr (jaapvstr) on 2008-03-26T15:49:09.000+0000

Linked to ZF-2937, since that was the original filed bug report. However this bug should be categorized with Zend_View instead.

Posted by Wil Sinclair (wil) on 2008-03-31T16:10:03.000+0000

Please evaluate and categorize as necessary.

Posted by Anders Petersen (anpeters) on 2008-05-02T12:11:52.000+0000

The suggested fix does not work on names like "mainProducts[]" (to submit arrays when using Zend_View_Helper_FormMultiCheckbox). It would generate an id like "mainProducts[]-product1", which is invalid according to W3C. I used this instead:
\
\

Using the option value to concatenate to element name as in the current implementation (1.6.1) may result in invalid option IDs, when using a non-ascii value (e.g. äöü as the option value results in )
I'd suggest using an option counter and add a option count number instead of the option value, which is just as useful, but avoids possible problems.