Yii Framework Forum: Best Practice For Form Splitting - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Best Practice For Form Splitting Rate Topic: -----

#1 User is offline   albyblueska 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 03-November 13

Posted 03 November 2013 - 08:28 AM

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,
Alberto
0

#2 User is offline   ORey 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,701
  • Joined: 20-April 09
  • Location:Moscow, Russia

Posted 03 November 2013 - 09:34 AM

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.
God is real unless declared as integer
0

#3 User is offline   albyblueska 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 03-November 13

Posted 03 November 2013 - 11:34 AM

View PostORey, on 03 November 2013 - 09:34 AM, said:

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?
0

#4 User is offline   albyblueska 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 03-November 13

Posted 03 November 2013 - 11:47 AM

View PostORey, on 03 November 2013 - 09:34 AM, said:

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.


..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?
0

#5 User is offline   ORey 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,701
  • Joined: 20-April 09
  • Location:Moscow, Russia

Posted 03 November 2013 - 11:50 AM

View Postalbyblueska, on 03 November 2013 - 11:34 AM, said:

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


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

View Postalbyblueska, on 03 November 2013 - 11:34 AM, said:

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


Yii has some protection against session stealing (need to configure, see here: http://www.yiiframew...topics.security), so I don't think it can be an issue.
God is real unless declared as integer
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users