PEAR HTML_QuickForm2: How to get the saved session container back in form
| From: | Sabine Visser | Date: | Tue, 16 Oct 2012 08:00:11 +0000 |
| Subject: | PEAR HTML_QuickForm2: How to get the saved session container back in form | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-31627@lists.php.net to get a copy of this message | ||
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(
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.
I suppose the answer lies hidden here
http://pear.php.net/manual/en/package.html.html-quickform2.controller-migration.php
but I couldn't make it work with any combination of
storeDataSources(), addDataSource() and setDataSources(). There seems
to be missing a setSessionContainer() method.
This is my first question on this list, please correct me if I did
anything wrong (format, type of question, etc.).
Kind regards and thanks for reading,
Sabine Visser