2009/12/18 Mike A <[email protected]>:
> Apologies - my previous post did not format correctly, so I repeat.
>
> When constructing a form element I use this...
>
>        $this->addElement('hidden', 'productId', array(
>            'decorators' => array(array('ViewHelper'),
>                                        array('HtmlTag', array('tag' => 'p')),
>                                        ),
>        ));

Try:

$this->addElement('hidden', 'productId', array(
           'id' => 'product_id_' . md5(uniqid());
           'decorators' => array(array('ViewHelper'),
                                       array('HtmlTag', array('tag' => 'p')),
                                       ),
       ));

I have not tested it though, you cant get the product_id in the init
as it would not be populated yet so product_id_1 product_id_2 etc is
not possible, though the id is not important you just need the name
attribute to stay the same.

>
> which formats as html (precisely) this way...
>
> <p>
> <input type="hidden" name="productId" value="11" id="productId" /></p>
>
>
> There are two problems with this. First, many input ids with "productId" 
> produces a validation
> error. Second, mark-up format is wrong. What must I do to produce this (with 
> value added to
> id)...
>
>    <p>
>    <input type="hidden" name="productId" value="11" id="productId" />
>    </p>
>
> TIA...
>
> Mike
>



-- 
------------
http://www.thepopeisdead.com

Reply via email to