Skip to content

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

Change placeholder to help text

dominik-zeglen9d912f76f9cc
diff --git a/saleor/discount/forms.py b/saleor/discount/forms.py
index 4bb2c9011b..a501243877 100644
--- a/saleor/discount/forms.py
+++ b/saleor/discount/forms.py
@@ -21,7 +21,7 @@ class CheckoutDiscountForm(forms.Form):
voucher = VoucherField(
queryset=Voucher.objects.none(),
to_field_name='code',
- label=pgettext_lazy(
+ help_text=pgettext_lazy(
'Checkout discount form label for voucher field',
'Gift card or discount code'),
widget=forms.TextInput)
diff --git a/saleor/static/scss/components/_forms.scss b/saleor/static/scss/components/_forms.scss
index 76b733a0d6..789467a36d 100644
--- a/saleor/static/scss/components/_forms.scss
+++ b/saleor/static/scss/components/_forms.scss
@@ -128,11 +128,16 @@ input#id_quantity {
}
.help-block {
- color: $red;
font-size: 0.8rem;
margin-top: $global-margin / 2;
}
+.has-error {
+ .help-block {
+ color: $red;
+ }
+}
+
.radio {
margin-bottom: $global-margin / 2;
ul {
diff --git a/templates/checkout/snippets/voucher_form.html b/templates/checkout/snippets/voucher_form.html
index 4de4464f33..6258ecbd21 100644
--- a/templates/checkout/snippets/voucher_form.html
+++ b/templates/checkout/snippets/voucher_form.html
@@ -26,7 +26,11 @@
{% csrf_token %}
<div class="form-group input-btn">
{% trans "Use" context "Checkout voucher form action" as use_voucher %}
- {% bootstrap_field form.voucher show_label=False %} {% bootstrap_button use_voucher button_type="submit" button_class="btn secondary narrow" %}
+ {% if form.errors %}
+ {% bootstrap_field form.voucher show_label=False show_help=False placeholder=False %}
+ {% else %}
+ {% bootstrap_field form.voucher show_label=False show_help=True placeholder=False %}
+ {% endif %} {% bootstrap_button use_voucher button_type="submit" button_class="btn secondary narrow" %}
</div>
</form>
{% endif %}