Yii Framework Forum: getting dynamic data - Yii Framework Forum

Jump to content

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

getting dynamic data Rate Topic: -----

#1 User is offline   Roopa 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 29-October 10

Posted 29 October 2010 - 05:07 AM

I want to send an email when registration process completes to that particular user.I know how to send,but my issue to get that email id from the registration form
0

#2 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 29 October 2010 - 05:23 AM

When you submit the form and set the $user->attributes = $_POST['User'], you can access the email from the model itself, but also you can get it by Yii::app()->request->getParam('User');, 'User' is a parameter array, email will be the named field value.

The above explanation assumes that your user model is named User and has a property field named 'email'

Hope it helps
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#3 User is offline   Roopa 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 29-October 10

Posted 29 October 2010 - 08:49 AM

View PostAntonio Ramirez, on 29 October 2010 - 05:23 AM, said:

When you submit the form and set the $user->attributes = $_POST['User'], you can access the email from the model itself, but also you can get it by Yii::app()->request->getParam('User');, 'User' is a parameter array, email will be the named field value.

The above explanation assumes that your user model is named User and has a property field named 'email'

Hope it helps


Thanks for ur reply,
I worked it in another way,i.e
before we save data we will be having $model->attributes=$_POST['Company'];
In that we can call $model->attributes[fieldname];

Now my issue is i am having company,users tables.I will enter id,pwd in company form and it will store in users table.but company table will not contain pwd feild.Now when i write pwd field explicitly in company form it showing error like "Property "Company.pwd" is not defined".

How can i add fields in a form which are not in db
0

#4 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 29 October 2010 - 08:53 AM

Congratulations!

Remember to title your post as SOLVED
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#5 User is offline   Roopa 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 29-October 10

Posted 29 October 2010 - 09:24 AM

View PostAntonio Ramirez, on 29 October 2010 - 08:53 AM, said:

Congratulations!

Remember to title your post as SOLVED


Now i struck up here, i want extra field in form which is not in db,how to resolve this issue
0

#6 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 29 October 2010 - 09:33 AM

Put the field whatever it is your form's view:


<?php echo CHtml::inputField('text','nameofthefield');?>

In your controller


Yii::app()->request->getParam('nameofthefield');


voilá
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#7 User is offline   Roopa 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 29-October 10

Posted 29 October 2010 - 09:59 AM

View PostAntonio Ramirez, on 29 October 2010 - 09:33 AM, said:

Put the field whatever it is your form's view:


<?php echo CHtml::inputField('text','nameofthefield');?>

In your controller


Yii::app()->request->getParam('nameofthefield');


voilá


I am getting "Fatal error: Call to protected method CHtml::inputField() from context 'CBaseController' in D:\xampp\htdocs\OneViewCRM\protected\views\company\_form.php on line 36"

I have written
<?php echo CHtml::inputField('password','passowrd'); ?>
0

#8 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 29 October 2010 - 11:29 AM

for a password field use:

CHtml::passwordField('nameofthefield','initialvalue');
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#9 User is offline   Maurizio Domba Cerin 

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

Posted 29 October 2010 - 02:12 PM

*** Note ***

this thread is not related to Yii-powered application

@Roopa please pay attention to post in the right sub-forum

Thread moved to Genera Discussion for Yii 1.1.x
Find more about me.... btw. Do you know your WAN IP?
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