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

From: Date: Thu, 18 Oct 2012 08:25:48 +0000
Subject: Re: PEAR HTML_QuickForm2: How to get the saved session container back in form
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-31630@lists.php.net to get a copy of this message
Hi Sabine, On 17.10.2012 19:39, Sabine Visser, lijsten wrote:
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?
In my layout the buttons of valid pages are green and those of the non-valid pages are red to help the (returning) visitor. When I only add the values, the session has no knowledge of valid pages, so all buttons are red.
Why not just save the values and later set them as defaults?
I did that, that works fine for the values.
Validation can be re-run either manually or automatically.
That's an interesting option, would you be so kind to give me a hint how I can accomplish the validation on re-entering the form?
See HTML_QuickForm2_Controller::isValid(), it handles the case of validating form pages that were not yet submitted / seen by the user. It doesn't look like you'll be able to use it directly, based on your description, but you can code a solution starting from it.

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