Yii Framework Forum: Auto complete fields of a previous values - Yii Framework Forum

Jump to content

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

Auto complete fields of a previous values Auto complete fields of a previous values Rate Topic: -----

#1 User is offline   NewUser 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 66
  • Joined: 18-November 11

Posted 28 June 2012 - 09:53 AM

I am doing a small application and my database is something like this

=== Invoices ===
  id (PK)
  customer_id
  invoice_title
  order_no
  invoice_issue_date
  due_date
  description

  === Customers ===
  id (PK)
  email_address
  customer_name
  address
  city
  state
  postal_code
  description

I have rendered the Customer model in Invoice model so that I can enter all the values for both models in a single Invoice form.But there is one problem,let us assume that I have a customer name xyz which I had saved before.Now when I am going to again fill the Customer name with xyz,it should show all the fields of both models like invoice_title,order_no,invoice_issue_date,due_date,description,email_address,customer_name,address etc. in that input fields of the form so that I don't have to re-enter all the fields again.So how this can be achive in Yii framework.Any help and suggestions will be highly appreciable.
0

#2 User is offline   Roman Solomatin 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 215
  • Joined: 21-October 10
  • Location:Tallinn, Estonia

Posted 28 June 2012 - 11:11 AM

You pre-fill your form-model with those values and then render the view with that model.

$formA = new FormA();
$formB = new FormB();
$formA->attribute1 = 'foor';
$formB->attribute2 = 'bar';

$this->render('view', array('modelA' => $formA, 'modelB' => $formB));

Hope this helps you out.
0

#3 User is offline   NewUser 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 66
  • Joined: 18-November 11

Posted 28 June 2012 - 11:25 AM

View PostRoman Solomatin, on 28 June 2012 - 11:11 AM, said:

You pre-fill your form-model with those values and then render the view with that model.

$formA = new FormA();
$formB = new FormB();
$formA->attribute1 = 'foor';
$formB->attribute2 = 'bar';

$this->render('view', array('modelA' => $formA, 'modelB' => $formB));

Hope this helps you out.

Thanks Roman Solomatin for your reply.But as I am a newbie to the Yii so I didn't get you.Can you simplify your answer?
Any help and suggestions will be highly appreciable.
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