Mercurial > libervia-templates
diff sat_templates/templates/bulma/input/field.html @ 349:2e548a9830c6
(bulma) input/field: fix `name` attribute + add `required` to checkbox
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 30 Nov 2021 17:25:35 +0100 |
parents | ae903ca0ed66 |
children | 1de6a0ecd529 |
line wrap: on
line diff
--- a/sat_templates/templates/bulma/input/field.html Thu Nov 18 16:25:27 2021 +0000 +++ b/sat_templates/templates/bulma/input/field.html Tue Nov 30 17:25:35 2021 +0100 @@ -67,10 +67,10 @@ {{ field("number", name=name, label=label, value=init, class=class, control_class=control_class, in_group=in_group, attrs={"min": min, "max": max, "step": step, "placeholder": placeholder}) }} {% endmacro %} -{% macro checkbox(name, label="", checked=false) %} +{% macro checkbox(name, label="", checked=false, required=false) %} {% set cur_id = name|next_gidx %} <label for="{{cur_id}}" class="label checkbox">{{label}}</label> - <input id="{{cur_id}}" type="checkbox" {% if checked %}checked=checked{% endif %}> + <input {{ {"id": cur_id, "name": name}|xmlattr }} type="checkbox" {% if checked %}checked=checked{% endif %} {{"required" if required}}> {% endmacro %} {% macro text(name, label="", value=none, class="", control_class="", placeholder=none, help="", required=false, pattern=none, title=none, autocomplete=none, icon_left=none, icon_right=none, in_group=false) %}