Hi,
looking at Form/Element.php at the setAttrib function you can understand how
the function works. you can tell that you can't just set null as the value.
/**
* Set element attribute
*
* @param string $name
* @param mixed $value
* @return Zend_Form_Element
* @throws Zend_Form_Exception for invalid $name values
*/
public function setAttrib($name, $value)
{
$name = (string) $name;
if ('_' == $name[0]) {
require_once 'Zend/Form/Exception.php';
throw new Zend_Form_Exception(sprintf('Invalid attribute "%s";
must not contain a leading underscore', $name));
}
if (null === $value) {
unset($this->$name);
} else {
$this->$name = $value;
}
return $this;
}
Vince.
On Wed, Apr 1, 2009 at 10:31 AM, <[email protected]> wrote:
> Hi all,
>
> Is there a way to disable the rendering of id attributes for form elements?
> I'm building a CMS which displays a tree of pages that can be edited. The
> tree consists of multiple forms for each page. I'ld rather not create unique
> for all of them.
>
> I tried:
> Zend_Form_Element::setAttrib( 'id', '' ); // results in invalid W3C code:
> id=""
> Zend_Form_Element::setAttrib( 'id', null ); // results in rendering
> id="<name of the element>"
>
> I just simply want to disable the id attribute. Any possibilities?
>
> Cheers
>
> ------------------------------
> Alle tips en trics. Ontdek nu de nieuwe Windows
> Live<http://www.microsoft.com/netherlands/windowslive/Views/tipsItemDetail.aspx>
>
--
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.