Re: DB_DataObject_FormBuilder get ID on insert?
| From: | Justin Patrin | Date: | Mon, 20 Jun 2005 06:24:55 +0000 |
| Subject: | Re: DB_DataObject_FormBuilder get ID on insert? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19688@lists.php.net to get a copy of this message | ||
On 6/19/05, Dan C <dankind@gmail.com> wrote:
> Hi,
>
> I have a 'contact' object with name, phone, address, etc. I'm trying
> to accomplish something along the lines of:
>
> Page 1: Search box (no problem)
> Page 2: Display existing 'contact' objects matching search, and show a
> form for new contact object (no problem)
> - If user clicks on existing 'contact' then pass it's primary key to
> Page 3 (no problem)
> - If user creates a new 'contact' object through the form, validate it
> and pass the newly created primary key to Page 3 ( here's the problem
> )
>
> The form submits fine and creates the object, but I have no idea how
> to get the newly created primary key. I've tried checking
> $form->getSubmitValues and $form->getElementValue('contact_id') but
> none of them seem to return the newly created ID.
>
> Is there something simple I'm missing here? How can I accomplish what
> I'm looking for? Any help would be greatly appreciated.
>
It's in the DataObject. $do->contact_id perhaps? It won't be in the
form. The DataObject is what is doing the DB stuff.
--
Justin Patrin