Re: [Phphtmllib-devel] multiple select box
Status: Beta
Brought to you by:
hemna
From: Walter A. B. I. <wab...@bu...> - 2002-06-05 22:18:37
|
Howdy, I actually found this issue as well, and have it fixed in the CVS version (2.0.0) of the libs. There is a 4th param to the form_select() function that is a flag to make the select tag add the multiple attribute. function form_select($name, $options=array(), $selected="", $multiple_flag=FALSE) { $select = new SELECTtag( array("name" => $name) ); if ($multiple_flag) { $select->set_tag_attribute("MULTIPLE"); } ... Walt On Wed, 2002-06-05 at 04:12, winston ralph wrote: > Hi, > Must say great class, it's made my job a hell of lot easier. > Nice standard, clean easy to read HTML. Just a small query. > I have looked through the classes and couldn't find how you > would draw a multiple select box. > eg; > <select name=test multiple=true> > <option>1</option> > <option>2</option> > </select> > > The following would suffice : ie change the form_select method to > something like the following > > > function form_select($name, $options=array(), $selected="") { > > $select = new SELECTtag( array("name" => $name) ); > > 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; > } > > Then call the method like so: > form_select($anonymous_array[], $options_array, "", "multiple => > true"); > > But maybe I missed something and it's already there? Keep up the great > work. > Must download and try out the new version very soon. > Regards, > > Winston > > |