Re: QuickForm - how can I make checkboxes where the vlaue equals something like - NAME=PET_ARRAY[] value=dog> Dog

From: Date: Tue, 21 Dec 2004 19:50:58 +0000
Subject: Re: QuickForm - how can I make checkboxes where the vlaue equals something like - NAME=PET_ARRAY[] value=dog> Dog
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16382@lists.php.net to get a copy of this message
On Tue, 21 Dec 2004 11:32:15 -0800 (PST), l Burnerheimerton <lburnerheimerton@yahoo.com> wrote: > I have table1, table 2 and a cross-reference table, table3. Table3 has two > fields, table1_ID and table2_ID. > > An exmaple might be, buildings (table1), people (table2), access (table3 > listing who has access to what buildings). > > So now that I have this cross-ref table I need to add and edit and delete > records. Add was not too difficult with Quickform. > > I am now working on how to edit. There are two parts to editing a table: > 1 - displaying the checkboxes with the existing records checked > 2 - when the update form is submitted, looping through the checkboxes to see > if any of them changed and updating table3. > > I have thought of others way to do this without using a cross-ref table. > For example, have an additional field in table 2 with a delimited list of > the table1_IDs. Then have a pull down. > > Or I could have multiple listboxes and javascript to move items around and > only process one list box. > > I guess what I am looking for is a best practice and how to code it. Maybe > using PEAR is not the best way to handle it - I don't know. Of course using PEAR is the best way ;-). You didn't list any code that you had tried. I assumed you had tried to do this already. You can do what you asked simply by calling addElement on an HTML_QuickForm object. Actually, it sounds like you would get a lot of benefit from DB_DataObject_FormBuilder, which deals with links, crossLinks, etc. It's pretty simple to set up and is very configurable. It can already do the checkbox thing you're asking about with its crossLinks option. > > Any help is much appreciated! > > > Justin Patrin <papercrane@gmail.com> wrote: > On Tue, 21 Dec 2004 05:37:58 -0800 (PST), l Burnerheimerton > wrote: > > I'd like to create checkboxes that render like this: > > > > Dog > > > Cat > > > Fish > > > What are you trying? Why is the output you're seeing not what you > want? You need to giv us something to start with here. > > I would suggest making the names PET_ARRAY[dog], etc. That way there's > a unique name for each one but you still get them in one array which > you can easily foreach() over. > > > > > The best I can come up with so far after MUCH working with it, is where > the value = 1. I could no tget advcheckbox to work like this either. > > > > Any ideas? Thanks! > > > > -- > Justin Patrin > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Justin Patrin

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