Multi Record user input with Autocomplete fields

Hello everyone I started digging into Yii a few months ago and I found this situation I’m not very sure how to deal with:

I have a product list where users add products dynamically. I want the user to fill in the information for product1, then press ‘Add product to list’, then fill in product2, … and so on. Each product is made of 3 or 4 autocomplete fields so that when the user starts typing… let’s say… the product’s name, the system suggests the name. I use CAutoComplete for this.

The thing is… this works fine with one record, but when I add another record at the end of the list, its autocomplete fields do not work.

I tried to add records by just copying the first record’s html code (<tr>…</tr>), and pasting it at the end of the list using jQuery. But then I figured out that I was missing each autocomplete’s javascript code and also that some id conflicts had to arise for sure.

So, any ideas for dynamically adding autocomplete records to a list?

Any help will be appreciated :)

This is a difficult problem I had a go but then gave up and moved to inputting one product per page, then moving to another page. You probably won’t be able to use Yii’s native widget, but might have to handcode each textfield into an autocomplete.

Thanks Alex, I guess I’ll have to write a custom widget or something like that