Re: Creating multiple elements of the same fields into an array with FormBuilder

From: Date: Sat, 22 Oct 2005 18:26:54 +0000
Subject: Re: Creating multiple elements of the same fields into an array with FormBuilder
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21598@lists.php.net to get a copy of this message
On 10/22/05, Dan Rossi <pear@electroteque.org> wrote: > I seem to be able to use the same object and it will display the > elements again in a flexy loop fine, however i cant seem to be able to > set the elements with an array elementname like fieldname[] , ive had > to pre define the elements in formbuilder becvause i need the element > names with an array obviouslly to display it more than once :| Any > ideas there ? > > On 22/10/2005, at 4:12 PM, Dan Rossi wrote: > > > Hi, Im trying to work out a way to create multiple elements of fields > > as arrays into a form. Ie I want the fields to be grouped in a row and > > then i can list say 5 rows of these elements. To give you an idea what > > i am doing. I am trying to be able add Track Titles for albums, but i > > would like to list more than one item at a time, say we had 10 tracks > > 10 rows. So in each row i want to display the title, a list menu of > > artist names from a DO and the duration. Any help with this would > > rock thanks. > > My advice is not to use an array and to use SubForm with multiple FBs, one for each record. Use an elementNamePrefix and/or elementNamePostfix to differentiate them. (*not* [] or anything with [ or ], use a normal string like _record_$n). If you need it to display in a table you can try to alter the QF renderer to display it differently (although I'm not sure how well this will work due to SubForm's hacked display methods). The other option would be to create an FB and form for each song, then extract the elements and insert them into a table. I would suggest trying FB's ElementTable for this. -- Justin Patrin

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