Custom Form Fields

Hi,

I’m looking at using Yii for a new application I’m building but have a concern about building dynamic form fields.

I will have a table called contacts for example which will have basic information such as first name and last name, but then want the user to be able to add additional fields such as phone number, address, status.

Details of the field will be stored in a database table with columns similar to this

field id, name, type, max length, permitted values

Then the values of that field for a user will be stored in another table with columns similar to this

contactid, fieldid, value

I’d also like to be able to group the fields into pages of fields.

What would be the best way to do this and does anyone have an example of how this might work? I’m still getting into the framework so am a little confused by a lot of the docs at the minute.

Thanks

Phil

Hi!

I think, you need very standart functional of Yii Framework.

Take the tour and create blog, then you will understand all that you ask for.

Yii blog tutorial

You should use Gii tool, generate model, then generate controllers and views by the CRUD-generating in Gii.

"Type, max length, permitted values" - all this You can change in your ActiveRecord model, which generates using Gii.

Why are you want to use two tables for the same data? With Yii You can do this without duplicating the data.