Bitrix Site Manager

SelectBoxMFromArray

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

The function SelectBoxMFromArray returns the HTML code of the tag <select multiple> with options from the passed array.

Parameters

ParameterDescription
name Tag name:
<select name="name" ... >
values List items. This array has the following format:
array(
    "REFERENCE" => 
        array(
            "Item title 1", 
            "Item title 2",
            ...
            ),
    "REFERENCE_ID" => 
        array(
            "Item title 1",
            "Item title 2",
            ...
            )
    )
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 "".
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



<?
$arr = array(
    "REFERENCE" => // array of item titles
        array("Choice 1", "Choice 2", "Choice 3"),
    "REFERENCE_ID" => // array of item values
        array(1, 2, 3)
    ); 
echo SelectBoxMFromArray("arrSEL[]", $arr, $arrSEL, "", false, 4, 
"class =\"inputselect\"");
?>