Re: [Phphtmllib-devel] form_select
Status: Beta
Brought to you by:
hemna
From: Walter A. B. I. <wab...@bu...> - 2002-07-31 06:08:45
|
Hey the list is still alive :) thanks for the email Winston. I've actually been working hard on the 2.0 version of the libs the last few days. I've been doing a lot of work on the widgets, and have added a new CSSBuilder widget that lets you build css on the fly. 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. Walt p.s. u can check out the latest version of the libs from cvs if you like the 2.0 api is not 100% compatible w/ 1.x There have been a LOT of updates, changes. On Tue, 2002-07-30 at 08:38, winston ralph wrote: > Hi, > > This kind of came up before. I found that I > > couldn't create a multiple select box. This has > > been rectified as you pointed out by passing the following: > > form_select($name, $options=array(), $selected="", > "TRUE"); > > This works fine if you only want to draw a multiple > > select box, but what happens if you want to change the > > multiple select boxes size. > > This is how I would propose to do this: > > 1: Change the form_select function like so: > > # attribs is an associative array > > function form_select($attribs, $options=array(), $selected="") { > > $select = new SELECTtag($attribs); > > while( list($label, $value) = each($options) ) { > $selected_value = ""; > if ($label == $selected) { > $selected_value = "SELECTED"; > } > $attributes = array( "value" => $value, $selected_value ); > $option = new OPTIONtag( $attributes ); > $option->push( $label ); > $select->push( $option ); > } > return $select; > } > > 2: The call would be as follows: > > $attribs = array("name"=>"test", "size"=>"10", "multiple"=>"true"); > > form_select($attribs, $options); > > Maybe you have spotted this already and changed it in the current > > version. All the best. > > Winston |