Yii Framework Forum: Session or hidden fields? - Yii Framework Forum

Jump to content

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

Session or hidden fields? Rate Topic: -----

#1 User is offline   seamus_d 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-August 11

Posted 11 June 2012 - 04:16 AM

Hey guys,
I suppose i have a rather simple question, but i am not able to answer it myself, yet. This is the scenario:

You collect user input within a form. The page/script the form is directed at (the form's action) should not process the input, but store it for the next script to process. So there is one script and html page between collecting and processing the data. What is the better way to störe the input. Should i write it to the Session or store it in hidden input field on the html page in between or is there a better way i did not even see yet?

Thanks for your replies!
Tim
0

#2 User is offline   binkabir 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 194
  • Joined: 25-July 10
  • Location:Abuja,Nigeria

Posted 11 June 2012 - 05:14 AM

hello, sessions is better
0

#3 User is offline   seamus_d 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-August 11

Posted 11 June 2012 - 05:24 AM

Is it "just" safer or easier or faster? What are the advantages?
0

#4 User is offline   binkabir 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 194
  • Joined: 25-July 10
  • Location:Abuja,Nigeria

Posted 11 June 2012 - 05:46 AM

creating hidden fields will make ur forms cumbersome while session will not only keep data to the next process but also maintain data for as long as you need it.
0

#5 User is offline   bettor 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 752
  • Joined: 02-February 09

Posted 11 June 2012 - 08:46 AM

Use statefulForm:

http://www.yiiframew...efulForm-detail

This will allow you to post page1 data to page2 data and is handled by Yii itself.
2

#6 User is offline   seamus_d 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-August 11

Posted 11 June 2012 - 05:15 PM

Awesome! That was what i looked for. Thanks!
0

#7 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 11 June 2012 - 05:47 PM

You could also use local storage. :)

<edit>
But statefulForm is great!
"Less noise - more signal"
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