Documentation

GetDropDownFilter

string
CForm::GetDropDownFilter(
 int field_id,
 string parameter_type,
 string filter_sid,
 string add_to_dropdown = "class=\"inputselect\""
)

Returns HTML code for filter field with dropdown single selection list. This dropdown list can be used for filtering of results by value of answer to question of the web form/link]. Values of this dropdown list are generated from the parameter values of [link=6660053#answer]answers - ANSWER_TEXT or ANSWER_VALUE. Non-static method.

Note
Name of resulting HTML field will be generated by the following mask:
find_filter_sid

Method parameters

Parameter Description Available from version
field_id ID of the question/field.
parameter_type Type of answer parameter. The following values are possible:
  • ANSWER_TEXT;
  • ANSWER_VALUE.
filter_sid Filter field identifier. It is generated by the following template:
FSID_QSID_PTYPE_dropdown,
где:
  • FSID - symbolic identifier of the web form;
  • QSID - symbolic identifier of the web form question/field;
  • PTYPE - type of answer parameter, specified in parameter_type.
Examples:
  • FORM_MARRIED_ANSWER_TEXT_dropdown;
  • FORM_CAR_ANSWER_VALUE_dropdown.
add_to_dropdown Custom HTML that will be added to the tag of dropdown list:
<select add_to_dropdown ...>

Optional parameter. By default - "class=\"inputselect\"".

See Also

Examples of use

<form name="form1" action="" method="POST">
<table>
    <tr>
        <td>Education:</td>
        <td><?
            $FIELD_ID = 15; // Question ID of "Your education?"
            echo CForm::GetDropDownFilter(
                $FIELD_ID, 
                "ANSWER_TEXT", 
                "FORM_EDUCATION_ANSWER_TEXT_dropdown", 
                "class=\"inputselect\""
                );
            ?></td>
    </tr>
</table>
<input type="submit" value="Filter">
</form>


© «Bitrix24», 2001-2024
Up