2009年5月21日星期四

Re: [fw-mvc] Avoid ID duplication on multiple subforms

Hi,

I already tried this doesn't help...

Cristian
Try modifying the name of the each subform in your foreach loop:

foreach($i=1; $i<=5; $i++){
    $f = new MainForm_Form_SecondSubform();
    $f->setName("subform{$i}");
    $this->addSubForm($f, 'sf2'.$i);
}

-Hector


On Thu, May 21, 2009 at 8:11 AM, Cristian Bichis <contact@zftutorials.com> wrote:
Hi,

I am trying to create a form which would have the values something like that:

0=>array('name'=>'blabla', 'periods'=>array(0=>array('start'='22.05.2009', 'end'='29.05.2009', 'price'=>'123'), 1=>array('start'='15.07.2009', 'end'='18.06.2009', 'price'=>'234'))
1=>..................

I am creating for this 2 levels of subforms, which are added this way: first subform is added to main form, second subform is added multiple times to first subform like this:

        foreach($i=1; $i<=5; $i++){
            $f = new MainForm_Form_SecondSubform();
            $this->addSubForm($f, 'sf2'.$i);
        }

I am getting some problems because the rendered form has some duplications on dt and dd id's:

<dt id="start-label">  <dd id="start-element">     
Would be the same for all those 5 subforms....

The labels from dt and so on are having diff id's that's fine:
<label for="SUBFORM-sf1-date"...... But for dt and dd that's not the same thing... 

I am trying to find some ways to avoid such duplication... Any tips ?
--  Best regards, Cristian Bichis www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com



--  Best regards, Cristian Bichis www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com

没有评论: