CHtml::activeTextField

How do I take the value of a field from one form to another??

I have a textfield ‘Anagra’ and I need to take the same value

in textfield ‘ANAGRA’ in next form

$_POST[‘Anagra’], i guess…

In the view???Or in the controller class????

if the first form you’re talking about is something like _form.php form, then you can access the data through the actions associated to it. for example, in the controller in actionUpdate or actionCreate you’ll get the value through:


$_POST['MODELNAME']['Anagra']

I should put $_POST[‘MODELNAME’][‘Anagra’][/code] in the second _form??? in the textfield??

<?php echo CHtml::activeTextField($model,‘ANAGRA_ANAGRA_ID’,array(‘VALUE’=>$_POST[‘anagrafe’][‘ANAGRA_ID’])); ?>

I tried but don’t work…why ????Help me…

$_POST values you read in the controller not in the view…

You haven’t told if those two forms are on the same page… or there is one form and after clicking submit you get the other form…

If there are two forms on one page and you want to copy the value of one filed to the other you have to use jQuery…

If there is one form that is submitet than this form is submited to the controler that can read the $_POST values and after that call the secont view with the second form passing the needed value…

For more info how yii and MVC (model view controler) works try to read and "understand" the definitive guide to Yii

http://www.yiiframew…ctivetextfield/

Yes i have

If there are two forms on one page and I want to copy the value of one filed to the other

How can i use jquery?

I found a solution by putting $_GET [‘id’] in the second form in which I want passing the needed value …

You have a better solution??