Multiple elements with the same identifier in the view - ZF2

advertisements

I am building a web application using ZF2 and Doctrine. I have a view containing a base form to which the user can add multiple instances of a fieldset, the filedsets are added via HTML template and js cloning. We are making use of the Doctrine hydrator and cascade=persist to write to the dB. It is all working but I am concerned when the fieldsets are added it results in multiple items with the same ID which breaks w3 standards. Has anyone a solution or work around for this? Or would it be considered acceptable in this instance?

An example of one fieldset element:

$this->add(array(
        'name' => 'glassAssemblyID',
        'attributes' => array(
            'type'=> 'hidden',
            'id' => 'glassAssemblyID',
        ),
    ));

Many thanks James


You should set the ID in JavaScript after cloning the element.