Re: QuickForm: how to handle displaying associative array as checkboxes or mulitple select select box?
| From: | Justin Patrin | Date: | Thu, 13 Jan 2005 23:29:54 +0000 |
| Subject: | Re: QuickForm: how to handle displaying associative array as checkboxes or mulitple select select box? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16926@lists.php.net to get a copy of this message | ||
On Thu, 13 Jan 2005 12:07:35 -0800 (PST), l Burnerheimerton
<lburnerheimerton@yahoo.com> wrote:
> I need to display, and get a data handle on during
> processing, an associative array.
>
> database tables are as such:
>
> TENANT
> tenantID
> ...
>
> OPTIONS
> optionID
> optionName
>
> OFFICE_ OPTION
> tenantID
> optionID
>
> I can get the associative array with no problem - a
> list of options for tenants.
>
> For new and existing tenants I need to diplay all
> options available. For existing tenants, I need to
> display all options available AND show the ones they
> have selected.
>
> Upon processing, I guess what I have to do is delete
> ALL options for that tenant in the OFFICE_ OPTION
> table and add the ones they have select or left
> untouched back into the table.
>
> This gets little so any help would be greatly appreciated!
>
Option 1: use DB_DataObject_FormBuilder and set up a crossLink. Then
set its 'type' to 'select'. This will create a multi-select with all
of the correct options selected (assuming I have not broken it
somewhere along the line :-| ).
Option 2: HTML_QuickForm support multi-selects with the 'multiple'
attribute. You can use setDefaults with an array for that element to
select multiple options.
--
Justin Patrin