Re: HTML_QuickForm + DB
| From: | Alexey Borzov | Date: | Tue, 20 Jan 2004 11:18:15 +0000 |
| Subject: | Re: HTML_QuickForm + DB | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10238@lists.php.net to get a copy of this message | ||
Hi!
Maik Jürgens wrote:
mostly i use HTML Forms for saving results to DB tables. Is their an easy way to save HTML_QuickForm to DB? I have seen DB_DataObject_FormBuilder to build HTML_QuickForm objects from a DB_DataObject. But this is not what I'm looking for. I'm looking for a class (maybe an HTML_QuickForm Extension) where i can set "DataSources" to each Field I want to save.I think you are over-engineering things. You don't need datasources for every separate field. Consider this: you can get a tuple from DB in an associative array and you can get data from the form as an associative array. Thus you can write a class that fetches this array from the DB by the primary key (and assign it to form via setDefaults()) and saves the array to the DB (you get this from the form via exportValues()). You can even write something that will generate such classes from the DB metadata. Of course, what I'm describing sounds suspiciously like DB_DO, but unlike DB_DO you can do the class that will query multiple tables or a view.