For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > January 2005 > Re: [PEAR] QuickForm: how to handle displaying associative array as checkboxes or mul









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] QuickForm: how to handle displaying associative array as checkboxes or mul
Justin Patrin

2005-01-13, 8:58 pm

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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com