[FIXED :)] Signup form

Good afternoon (or is it Morning for you!)

I have a simple question about the best way to model and control the process of having a user sign up.

Basically I have a User table which extends CActiveRecord. Should I be using this same model in the sign up form, or should I create a SignUpFormModel?

I ask because the form contains a number of fields which are not in the User DB table (e.g. password2 to compare etc.) Is there a clean way of having fields in the CActiveRecord model which are not to be persisted to the DB… Or do I have to manually reference these fields using $_POST etc.

TIA

Yes, you can use your User AR to collect signup information. You may declare those additional fields as public members of this AR class. Make sure you override safeAttributes() to specify these additional members as safe attributes.

I have experience some problems with this however.

I want to apply some validation rules to these fields, but when I set for example the rule : array('password2','required'),

The validation always fails even when password2 is not empty. Should validaton rules work as normal for these fields?

It seems that the validation rules do not recognise attributes which are not part of the active record.

My apologies!!

I didnt think that overriding safeAttributes would fix this but it has…

Thanks very much qiang !!