Bitrix Site Manager

SelectBoxM

string
SelectBoxM(
 string name,
 CDBResult values,
 array selected,
 string top_element = "",
 bool select_top_element = false,
 int size = 5,
 string add_to_tag = "class=\"typeselect\""
)

The function SelectBoxM returns the HTML code of the tag <select multiple> with options from the CDBResult object.

Parameters

ParameterDescription
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).
selected Selected items. The values of this array are matched against fields "REFERENCE_ID" of the values records. Fields (list items) that are equal to selected values becomes selected in the list.

Optional. The default value is "".
top_element Title of the top item in the list, optionally selectable (parameter select_top_element). This item has a value of "NOT_REF".

Optional. The default value is "" (do not add).
select_top_element If "true", the item top_element is always selected.

Optional. The default value is false (do not select).
size Value of the size tag:
<select size="size" ... >
This parameter contains the number of visible lines in the list.

Optional. The default value is 5.
add_to_tag Arbitrary HTML to add to the tag:
<select add_to_tag ... >

Optional. The default value is "class=\"typeselect\"".

See Also

Example



<?
// create selection from the groups table
$strSql = "
    SELECT
        G.ID as REFERENCE_ID,
        G.NAME as REFERENCE
    FROM
        b_group G
    WHERE
        G.ID<>2 -- group everybody containing all users by default
    ";
$rs = $DB->Query($strSql, false, "FILE: ".__FILE__."<br>LINE: ".__LINE__);

// display a list of groups
echo SelectBoxM("arrGROUP[]", $rs, $arrGROUP, "< group everybody >", true, 20, 
"class =\"inputselect\"");
?>