[horde] Re: Horde_Form_Type_enum

Jan Schneider jan at horde.org
Mon Feb 21 12:42:45 PST 2005


Zitat von Christopher Troup <mini at zaphod.homeunix.com>:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> No go :-(
> with:
> foreach ($comments as $comment) {
> 	$com[$comment->getId()] = $comment->getTitle();
> }
> $form->addVariable('Edit Which Comment','com','enum',false,false,'',$com);

$form->addVariable('Edit Which 
Comment','com','enum',false,false,'',array($com));


> I'm getting the following errors:
> Warning: array_keys() [function.array-keys]: The first argument should
> be an array in /usr/local/lib/php/Horde/Form.php on line 230
> and
> Warning: Invalid argument supplied for foreach() in
> /usr/local/lib/php/Horde/UI/VarRenderer/html.php on line 1182
>
> I've been going through other horde application code to see if I can
> find any hints there, but so far no luck. Does anyone have a solution or
> a suggestion at a php file that might have the solution in it?
>
> Thanks
>
> Jan Schneider wrote:
>> Zitat von Christopher Troup <mini at zaphod.homeunix.com>:
>>
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Hello,
>>> I'm trying to add a select box with specified titles and values. However
>>> from what I can see from Horde/Forms.php there is no way of getting
>>> something like <option value="315">This is an option</option>. It seems
>>> to default to values counting 0,1,2,3,4...
>>>
>>> Obviously I must be wrong, and there must be a way to specify values.
>>> Here is code that I'm using.
>>>
>>> //$com is an array of option titles
>>> $form->addVariable('Edit Which Comment','com','enum',false,false,'',$com);
>>>
>>> it seems like I should be able to do something like
>>> $com[0][$i] = 'This is an option';
>>> $com[1][$i] = 315;
>>
>>
>> Try this instead:
>> $com[315] = 'This is an option';
>>
>> Jan.
>>
>
> - --
> Christopher Troup
> http://zaphod.homeunix.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1-cvs (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFCGkW79vsfLoZxqLoRAjfrAJ9MAKayZyHJzjq+/nH6k0igHPQY4wCaA3Nw
> RYpIfZM1tD44UdjynO/A7b4=
> =SJpl
> -----END PGP SIGNATURE-----
>
> --
> Horde mailing list - Join the hunt: http://horde.org/bounties/#horde
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org
>
>



Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/


More information about the horde mailing list