r"""A group of check box that allowing single values to be selected/deselected. :param list options: List of options. The format is the same as the ``options`` parameter of the `select()` function :param bool inline: Whether to display the options on one line. Default is ``False`` :para
(label: str = '', options: List[Union[Dict[str, Any], Tuple, List, str]] = None, *, inline: bool = None,
validate: Callable[[Any], Optional[str]] = None,
name: str = None, value: List = None, onchange: Callable[[Any], None] = None, help_text: str = None,
**other_html_attrs)
| 388 | |
| 389 | |
| 390 | def checkbox(label: str = '', options: List[Union[Dict[str, Any], Tuple, List, str]] = None, *, inline: bool = None, |
| 391 | validate: Callable[[Any], Optional[str]] = None, |
| 392 | name: str = None, value: List = None, onchange: Callable[[Any], None] = None, help_text: str = None, |
| 393 | **other_html_attrs): |
| 394 | r"""A group of check box that allowing single values to be selected/deselected. |
| 395 | |
| 396 | :param list options: List of options. The format is the same as the ``options`` parameter of the `select()` function |
| 397 | :param bool inline: Whether to display the options on one line. Default is ``False`` |
| 398 | :param list value: The value list of the initial selected items. |
| 399 | You can also set the initial selected option by setting the ``selected`` field in the ``options`` list item. |
| 400 | :param - label, validate, name, onchange, help_text, other_html_attrs: Those arguments have the same meaning as for `input()` |
| 401 | :return: A list of the values in the ``options`` selected by the user |
| 402 | """ |
| 403 | assert options is not None, 'Required `options` parameter in checkbox()' |
| 404 | |
| 405 | item_spec, valid_func, onchange_func = _parse_args(locals(), excludes=['value']) |
| 406 | item_spec['options'] = _parse_select_options(options) |
| 407 | if value is not None: |
| 408 | item_spec['options'] = _set_options_selected(item_spec['options'], value) |
| 409 | item_spec['type'] = CHECKBOX |
| 410 | |
| 411 | return single_input(item_spec, valid_func, lambda d: d, onchange_func) |
| 412 | |
| 413 | |
| 414 | def radio(label: str = '', options: List[Union[Dict[str, Any], Tuple, List, str]] = None, *, inline: bool = None, |
no test coverage detected
searching dependent graphs…