string SelectBox( string name, CDBResult values, string default = "", string selected = "", string add_to_tag = "class=\"typeselect\"" )
The function SelectBox returns the HTML code of tag <select> (drop-down single selection list) with options from the CDBResult object.
Parameter | Description |
---|---|
name | Tag name: <select name="name" ... > |
values | List items. An object of type CDBResult containing a set of records each having the following fields: "REFERENCE_ID" (list item value) and "REFERENCE" (list item text). |
default | Title of the default item. This item has a value of "NOT_REF".
Optional. The default value is "" (do not add this item). |
selected | Selected item. The value of this parameter is matched against fields "REFERENCE_ID" of the values records. The field (list item) that is equal to selected becomes selected in the list. Optional. The default value is "". |
add_to_tag | Arbitrary HTML code to be added to tag: <select add_to_tag ... > Optional. The default value is "class=\"typeselect\"". |
<? // create selection from the groups table $strSql = " SELECT G.ID as REFERENCE_ID, G.NAME as REFERENCE FROM b_group G "; $rs = $DB->Query($strSql, false, "FILE: ".__FILE__."<br>LINE: ".__LINE__); // display the drop-down list echo SelectBox("GROUP", $rs, "< select group >", $GROUP, "class =\"inputselect\""); ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |