Re: DB_DataObject, FormBuilder & Quickform tutorial?
| From: | Justin Patrin | Date: | Mon, 23 Oct 2006 22:56:53 +0000 |
| Subject: | Re: DB_DataObject, FormBuilder & Quickform tutorial? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25598@lists.php.net to get a copy of this message | ||
On 10/23/06, Chris Boget <chris.boget@wild.net> wrote:
Could someone point me to a tutorial that discusses how to set up the two so you can edit multiple existing records from the DB? I've searched and the only pages I've been able to find are those that discuss how to set up a form for a single record. I've tried calling ->find() before I call the create() for DB_DataObject_FormBuilder but that didn't seem to do much of anything. Am I not going to be able to use the formbuilder?FormBuilder is a package that creates a form for a *single* record. That's it's job. It does have some features which enable creating a form for multiple records. If you just call find() on a DO you're going to get a "new record" form. You have to call fetch() in order to populate the DO and get a form for that record. Then you can call fetch() again and create another form. To combine multiples in the same form, use elementNamePrefix/Postfix and useForm(). Here's a simple example from the FB docs: http://pear.reversefold.com/dokuwiki/doku.php?id=pear:db_dataobject_formbuilder:formbuilder_configuration_options#elementnameprefix -- Justin Patrin