1

Let's say i have a database table called 'people'.

70% of the fields in this table are created by the user submitting a form, the other 30% are fields populated from other data.

To describe this table I used Gii to create a model (People.php) which extends CActiveRecord.

I then realisied that to display a form I need to extend CFormModel. This class need only display to the user and collect data for 70% of the database fields. It's only purpose is to display a form and collect data.

My question is how can this be done when I already have a model class called People?

Thank you. Hope that makes sense,

rix
  • 10,104
  • 14
  • 65
  • 92

1 Answers1

3

You can as well create a form using CActiveForm class, which can directly relate form fields to model fields.

It will be a lot easier if you generate your controller and views as well from Gii, and then you can customize it as you like.

Waiting for Dev...
  • 12,629
  • 5
  • 47
  • 57
  • Yeah, it seems just using CRUD generator rather than seperately creating model, controller, view is the fastest way to get up and running. Thanks for your time – rix Apr 13 '12 at 10:37