Re: QuickForm: storing the whole form in a session variable

From: Date: Sun, 06 Nov 2005 18:07:30 +0000
Subject: Re: QuickForm: storing the whole form in a session variable
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21816@lists.php.net to get a copy of this message
Hi, Justin Patrin wrote:
This would save me the form recreation in the process/validate phase. Sadly this fails because PHP complains about not defined QuickForm subclasses while restoring the session.
Yes, this is a problem with putting things in the session. You have to define all of the classes that can be saved before using them. If you're using PHP5 you can use __autoload() to make this easier.
In PHP4, unserialize_callback_func can be used: http://www.php.net/manual/en/function.unserialize.php Though I'd suggest first profiling the application and turning to such session-related hacks only if actual form-building (*not* loading the stuff from the database) takes a lot of time.

« previous php.pear.general (#21816) next »