Yii Framework Forum: CHtml::activeTextField - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CHtml::activeTextField Rate Topic: -----

#1 User is offline   kitty10 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 139
  • Joined: 13-April 10

Posted 28 April 2010 - 06:22 AM

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
0

#2 User is offline   joeysantiago 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 01-April 10

Posted 28 April 2010 - 08:07 AM

$_POST['Anagra'], i guess...
joey santiago

an Italian with Suomi inside.
0

#3 User is offline   kitty10 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 139
  • Joined: 13-April 10

Posted 28 April 2010 - 08:51 AM

View Postjoeysantiago, on 28 April 2010 - 08:07 AM, said:

$_POST['Anagra'], i guess...


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

#4 User is offline   joeysantiago 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 01-April 10

Posted 28 April 2010 - 09:41 AM

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']

joey santiago

an Italian with Suomi inside.
0

#5 User is offline   kitty10 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 139
  • Joined: 13-April 10

Posted 28 April 2010 - 01:51 PM

View Postjoeysantiago, on 28 April 2010 - 09:41 AM, said:

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..
0

#6 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 28 April 2010 - 03:32 PM

$_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/
Find more about me.... btw. Do you know your WAN IP?
0

#7 User is offline   kitty10 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 139
  • Joined: 13-April 10

Posted 29 April 2010 - 04:31 AM

View Postmdomba, on 28 April 2010 - 03:32 PM, said:

$_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??
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users