Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add multiple checkbox to materialize form fields

Krzysztof Białogłowiczbd633ead38dd
diff --git a/templates/materializecssform/field.html b/templates/materializecssform/field.html
index 60c1d49203..3de4487479 100644
--- a/templates/materializecssform/field.html
+++ b/templates/materializecssform/field.html
@@ -25,6 +25,29 @@
</p>
</div>
</div>
+{% elif field|is_multiple_checkbox %}
+ <div class="input input-field col {{ classes.label }}">
+ {% if field.auto_id %}
+ <label class="control-label {{ classes.label }}">
+ {{ field.label }}{% if not field.field.required %} ({% trans "optional" context "Dashboard form labels" %}){% endif %}</label>
+ {% endif %}
+ {% for choice in field %}
+ <p>
+ <input id="{{ choice.id_for_label }}" name="{{ choice.name }}" class="filled-in" type="checkbox" value="{{ choice.choice_value }}" {% if choice.choice_value in choice.value %} checked="checked" {% endif %}>
+ <label for="{{ choice.id_for_label }}">{{ choice.choice_label }}</label>
+ </p>
+ {% endfor %}
+
+ {% for error in field.errors %}
+ <p class="help-block materialize-red-text">{{ error }}</p>
+ {% endfor %}
+
+ {% if field.help_text %}
+ <p class="help-block">
+ {{ field.help_text|safe }}
+ </p>
+ {% endif %}
+ </div>
{% elif field|is_radio %}
<div class="input input-field col {{ classes.label }}">