Re: PEAR HTML_QuickForm2: How to get the saved session container back in form
| From: | Alexey Borzov | Date: | Wed, 17 Oct 2012 09:00:22 +0000 |
| Subject: | Re: PEAR HTML_QuickForm2: How to get the saved session container back in form | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-31628@lists.php.net to get a copy of this message | ||
Hi Sabine,
On 16.10.2012 12:00, Sabine Visser wrote:
I am using the controller to make a multiple page form. I am saving submitted and unsubmitted applications data to a database field: $serialized_data = $oCon->dbConn->real_escape_string(There is no means to replace a controller's session container with a custom instance unless you extend the Controller class. So you can serialize/unserialize it, but you won't be able to do anything useful after that. Also note that session container object contains a reference to $_SESSION field, I'm not sure how well it will survive (un)serialization.serialize($ctrl->getSessionContainer())); $oCon->dbConn->query("INSERT INTO form_data SET (data) VALUES ('" . $serialized_data . "')");
That works fine but how do I get the saved object back into the session for unfinished entries? Getting only the values back works when saving them to the database field with $ctrl->getValue() and getting them back with $ctrl->addDataSource(new HTML_QuickForm2_DataSource_Array($unserialized_data)); but I need the whole object with the valid pages array as well.What's the point of saving the validation status? Why not just save the values and later set them as defaults? Validation can be re-run either manually or automatically.