[EXTENSION] jqrelcopy

Hi all,

I am a Yii newbie and this is my first post!

I am trying to manage a MANY_MANY relation in the same form. I have the following shceme:

tbl_order – 1:n – tbl_order_products – n:1 – tbl_products

This relation is defined as follows:

   public function relations()



   'products' => array(self::MANY_MANY, 'Products', ' tbl_order_products(order_id, product_id)'),



Now I am trying to create a form where the user can add Products to the Order dynamically. For such I am using jqrelcopy extension. When I click on "Add Product" link 3 new form elements should be added to the form:

  1. drop-down list for selecting the Product

  2. text field to set the quantity of each product

  3. <span> tag element to display the product price (which is defined in tbl_products) as the product is being selected on drop-down element. This should be done through Ajax request:

  <div class="row copy">


        echo CHtml::dropDownList(



                              CHtml::listData(Products::model()->findAll(array('order'=>'t.product ASC')),'id','product'),


                                    'ajax' => array(

                                              'type' => 'POST',


                                              'update' => '#price',




      <?php echo CHtml::textField('quantity[]','quantity'); ?>

      <?php echo CHtml::tag('span',array('id'=>'price'),); ?>


I can see the actionProductPrice() is being executed as expected. However this solution fails because I cannot generate an unique id for each <span> element that is dynamically added and then relate it with ‘update’ field of ajax request.

Can anyone help me on that?

By the way, what is the best extension to manage MANY_MANY relations in forms?

Thanks for your help,


Anybody can help me?

I have the exactly the same problem.

I only know that ajax code don’t copy in the client side.

Somebody help please.