动态地向Yii 1.1表单添加元素

I was trying to add elements dynamically to a yii 1.1 TbActiveForm. I tried two methods to do this, but fails when it comes to validation. Please see my methods below.

Method 1 # Clone elements; modify id's

This is how i create form

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id' => 'form-name',
    'enableClientValidation' => true,
    'clientOptions' => array(
        'validateOnSubmit'=>true
    ),
    'action' => $this->createUrl('test/manageusers')
)); 

On clicking on the "Add more" button, this script will duplicate elements

$('#add-comp-user').on('click', function(){ 
      // template 
      var html = $('.add-comp-users-wrapper').first().clone();
      // next element index
      var next_index = // find last element's index attribute
      // update element id's
      html.find(':input').each(function(){ 
         // update name 
         // update id

      });
      // insert to DOM
});

Method 2 #Ajax method Here, on cliking on "Add more" button, i will render form elements with new id and insert to DOM

Both these methods failed in validation. How can i include a newly added element to Yii validation ?