Need help in jqrelcopy controller to get duplicated textfields values using textfield id

Hi, I’m new to yii framework.

I want to duplicate the textfield when the user clicks add button and is able to delete the textfield when they click the delete button. Currently, I’m using jqrelcopy extension to do so.

I have a problem at the controller side. I can’t seem to retrieve all the duplicated textfields values. I can only retrieve the last textfield value based on the textfield name using the codes shown below. I realised that using “$_POST[‘Contact’][‘contact_email’]” in the controller would only give me the textfield value of the last textfield because all the duplicated textfields will have the same name, only the textfield id will be different.

Hence, I think that I need to get the value of the textfield using textfield id instead of textfield name at the controller side. Is there any way of doing that?

I can’t seem to find much examples of jqrelcopy on the controller. Those that I saw I can’t really understand. Is there any other way that I can modify my codes below to get all the values of the duplicated textfields in the controller?

Below are a portion of my codes:



$form=$this->beginWidget('CActiveForm', array(



	'enableClientValidation' => true,




<div class="row copy">

<?php echo $form->textField($model,'contact_number',array('size'=>35,'maxlength'=>100)); ?>

<?php echo $form->textField($model,'contact_email',array('size'=>35,'maxlength'=>100)); ?>


<?php $this->endWidget(); ?>





echo $_POST['Contact']['contact_number'];

echo $_POST['Contact']['contact_email'];


I would just make the input names an array:

<div class="row copy">

<?php echo $form->textField($model,'contact_number[]',array('size'=>35,'maxlength'=>100)); ?>

<?php echo $form->textField($model,'contact_email[]',array('size'=>35,'maxlength'=>100)); ?>


Then loop through those when you process.

It worked. Thanks a lot! :)

NP… don’t forget to hit the + button (bottom right of my post)

Ok. Done :)