Best Practice For Form Splitting

Hi all,

I know that there are similar dicussion on the forum, but I wasn’t able to find specific answers to the problem below:

I have a DB schema made of a parent table USERS (with general information about users) and some child tables with specific information (let’s call them USERS_A, USERS_B, etc…). The child tables are linked to the parent table trough a foreign key.

Now, I want to implement a registration form for type A users.

My idea is to implement a form made of 2 steps where in the first step it asks basic information (to be inserted in table USERS) and in step 2 specific information for type A to be inserted in table USERS_A.

I want the two records to be inserted in a single transaction, even the data collected in two steps.

I thought to record the info from the first step of the form inside session using Stateful form, then collect the 2nd step and, finally, insert both records in the DB.

Is this process correct? Is there any problem saving the username and password in session until the other data are collected?

Or maybe, is there any other best practice to do so?

Thanks for the support,


Seems correct.

Personally I prefer having all the data on one page and split them using js+css, but I have nothing against stateful forms.

My only concern about js+css (or ajax) is about browser compatibility?

Anyway, isn’t there any issue in storing data like password in session using stateful form?

…when you say "having all the data on one page and split them using js+css" you mean to have a unique form with an object CActiveForm that "embed" the other objects (in my case USER and USER_A), right?

Call me crazy, but there’s no such a problem nowadays, if we’re not taking into account strange people with old-fashioned phones )

Yii has some protection against session stealing (need to configure, see here:, so I don’t think it can be an issue.