Re: [Phphtmllib-devel] form_select
Status: Beta
Brought to you by:
hemna
From: Walter A. B. I. <wab...@bu...> - 2002-08-01 16:56:59
|
On Thu, 2002-08-01 at 03:05, winston ralph wrote: > > > > Anyways, in reference to your question, it seems all you really want > > is the ability to specify the size. I can add that as another param. > > right now the 2.0 (dev) interface looks like > > function form_select($name, $options=array(), $selected="", > > $multiple_flag=FALSE) > > > > I will add size before the $multiple_flag param if no one objects. > > > > Would it not be a better idea to have an attributes array? There > are more attributes other than size that a select box can take. ---what the wrapper functions are trying to do is provide a standard api for the most common types of attributes used for a tag. With that being said, not all wrapper functions provide all possibilities for all attributes for a particular tag. Now with respect to form_select() the majority of the time folks don't use a multiple select, nor do they modify the size, hence the limited params. The upside is, that you can add any attributes you want in several ways. 1) build the tag manually using the new SELECTtag( $attributes ); you can put anything u want in the attributes array there. This sux, because its a "manual" process to build the select and all of it's attributes. 2) call form_select() with the current set of params. Then on the return of that call, add the missing attributes u want $select = form_Select("states", $state_options, $selected_items, $size, TRUE); $select->set_tag_attribute("foo", "bar"); or $select->set_tag_attributes(array("foo"=>"bar", "blah"=>"floop")); I would prefer this, because it keeps the api to the form_* functions similar. If you want to just pass an array of attributes, then use the SELECTtag object. All of the wrapper/helper functions are just that...helpers for the most common attributes used. If you wanted max flexibility to all the helper functions then they would all take an array as the first param, but this would make for hard to read code. The great thing about not using an array for attributes, is it makes the call readable, and consistent accross applications/pages. All that being said....what are the other attributes that you think are missing to form_select() ? > Then at least the function call doesn't get unwieldy. > Also the form_select method can only take 1 selected option. --not true. form_select can take an array for the selected items. (2.0) > This is insufficient if you have selected multiple options from > a multiple select box. > Regards, > Winston > > P.s thought my last mail didn't get through and the list was > finished. Good to see its still going strong, and look forward to > 2.0 (can you make it LGPL?) 2.0 is LGPL :) my $0.02 Walt |