Re: Nested forms

From: Date: Thu, 21 Oct 2004 17:43:57 +0000
Subject: Re: Nested forms
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15024@lists.php.net to get a copy of this message
On Thu, 21 Oct 2004 09:04:13 -0700, Ken Restivo <ken@restivo.org> wrote: > I'm wrestling with the nested forms example from the slide show tutorial. This may be a > bit over my head but I need it for my application. > > I found the example easy and it looks fantastic when applied to my tables. But it botches my > database when it gets processed. It doesn't seem to do a last_insert_id() and insert the > 'one' table's primary key properly into the 'many' table-- big trouble. > > If I do $many_builder->useForm($one_table) and $one_table->fb_createsubmit = false, I get > ID's of zero, and only the many_table gets saved to the DB, the one_table does not. > > If I do $one_builder->useForm($many_table) and $many_table->fb_createSubmit = false, it > displays a popup of my $one_table->id on screen, with a random ID (23). > > I suspect this may be an incrementing problem. But I can't use PHP's incrementing, I > *must* use autoincrement and last_insert_id. The PHP code is not the only thing that will be > modifying the database, it needs to have unique ID's and they need to be assigned by mysql. > > I feel like I may be doing something obviously wrong here, but after pounding on it a while > I've no idea what. > Well, that's not very well supported functionality. If *any* of the fields in the multiple tables you're creating forms for are named the same, you're going to get unknown (and quite possibly wrong) results. There's a feature request for adding post and pre-fixes to the QF vars to fix this, but we haven't gotten around to implementing it yet. I'd love to see real multi-form functionality. Care you try your hand at it and submit a patch? -- paperCrane --Justin Patrin--

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