Question

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,

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top