Documentation

GetDateFilter

string
CForm::GetDateFilter(
 int filter_sid,
 string html_form_name = "form1",
 string show_dropdown = "Y",
 string add_to_dropdown = "class=\"inputselect\"",
 string add_to_text = "class=\"inputtext\""
)

The method returns HTML code of filter field, intended for filtering of results by dates, inputed as the answer to the web form question or values of the "date" type webform fields. Returned HTML code includes two fields, intended for input of date range, as well as specific auxiliary elements (calendar, dropdown list of days). Non-static method.

Note
Names of resulting HTML fields will be generated by the following masks:
find_filter_sid_1 - first field for date range (from)
find_filter_sid_2 - second field for date range (to)

Method parameters

Parmaeter Description Available from version
filter_sid Filter field ID. Generated by the following template:
FSID_QSID_USER_date,
where: Examples:
  • FORM_USER_BIRTHDAY_USER_date
  • FORM_DATE_FIELD_USER_date
html_form_name Name of HTML form, to display filter.
<form name="html_form_name" ...>

Optional parameter. Default value - "form1".
show_dropdown If set to "Y", the returned HTML code will include the Dropdown list of says, intended to simplify selection of date.

Optional parameter. Default value - "Y" (display dropdown list of days).
add_to_dropdown If show_dropdown="Y", this parameter can specify custom HTML, to be added to the tag of dropdown list of days:
<select add_to_dropdown ...>

Optional parameter. Default value - "class=\"inputselect\"".
add_to_text Custom HTML to be aded to tags of single line text fields, intended for inputting the date:
<input type="text" add_to_text ...>

Optional parameter. Default value - "class=\"inputtext\"".
field_select Optional parameter.
field_input Optional parameter. Modified from 4.0.4

See Also

Examples of use

<form name="form1" action="" method="POST">
<table>
    <tr>
        <td>Date of birth:</td>
        <td><?
            echo CForm::GetDateFilter(
                "FORM_USER_BIRTHDAY_USER_date", 
                "form1", 
                "Y", 
                "class=\"inputselect\"", 
                "class=\"inputtext\""
                );
            ?></td>
    </tr>
</table>
<input type="submit" value="Фильтр">
</form>


© «Bitrix24», 2001-2024
Up