Sabine
Sabine

Reputation: 141

PEAR HTML_QuickForm2: How to get the saved session container back in form

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 getValue() and

$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 in this page 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 forum, I tried to stick to all the rules, please correct me if I made stupid mistakes or if this is a stupid question.

Upvotes: 4

Views: 431

Answers (1)

geoidesic
geoidesic

Reputation: 5053

I think you're mis-understanding how to use Quickform2. If you need to work with a multi-page form then you want to make use of QuickformController: http://pear.php.net/manual/en/package.html.html-quickform2.controller-overview.php

Upvotes: 0

Related Questions