Auto complete fields of a previous values

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.

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.