Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Customer login form / Error messages are not displayed

Customer login form / Error messages are not displayed

Svyatoslav
Tourist
10 1 2

Hello there!
I can't output error messages in "Customer login form".
Снимок экрана 2020-09-07 в 14.01.01.png

 

 

 

 

 

 

 

 

 

 

 

The fields are not colored. And no error messages is displayed under the fields.
Content of the file "login.liquid":

			<div>
				<h4 id="LoginHeading" class="text-center mb-3">{{ 'customer.login.title' | t }}</h4>
				
				{%- assign formId = 'CustomerLoginForm' -%}
				{% form 'customer_login', id: formId, novalidate: 'novalidate', class: 'd-flex flex-column vertical-form' %}
				{% include 'form-status', form: form, form_id: formId %}
				<input 
					type="email"
					name="customer[email]"
					id="{{ formId }}-email"
					class="input mb-1{% if form.errors contains 'email' %} input--error{% endif %}"
					{% if form.email %} value="{{ form.email }}" {% endif %}
					autocorrect="off"
					autocapitalize="off"
					autocomplete="email"
					aria-required="true"
					{%- if form.errors contains 'email' -%} aria-invalid="true" aria-describedby="{{ formId }}-email-error" {%- endif -%}
					placeholder="{{ 'customer.login.email' | t }}"
				>

				{%- if form.errors contains 'email' -%}
				<span id="{{ formId }}-email-error" class="input-error-message">
					<span class="visually-hidden">{{ 'general.accessibility.error' | t }}</span>
					{% include 'icon-error' %}
					<span>{{ form.errors.translated_fields['email'] | capitalize }} {{ form.errors.messages['email'] }}.</span>
				</span>
				{%- endif -%}

				{% if form.password_needed %}
				<input
					type="password"
					value=""
					name="customer[password]"
					id="{{ formId }}-password"
					class="input mb-1{% if form.errors contains 'password' %} input--error{% endif %}"
					aria-required="true"
					{%- if form.errors contains 'password' -%} aria-invalid="true" aria-describedby="{{ formId }}-password-error" {%- endif -%}
					placeholder="{{ 'customer.login.password' | t }}"
				>
				{% endif %}

				{%- if form.errors contains 'password' -%}
				<span id="{{ formId }}-password-error" class="input-error-message">
					{% include 'icon-error' %}
					<span>{{ form.errors.translated_fields['password'] | capitalize }} {{ form.errors.messages['password'] }}.</span>
				</span>
				{%- endif -%}

				<div class="text-center mt-2">
					<input type="submit" value="{{ 'customer.login.sign_in' | t }}" class="button w-button mb-075">
					<p>{{ 'layout.customer.create_account' | t | customer_register_link }}</p>
					{% if form.password_needed %}
					<p><a href="#recover" id="RecoverPassword">{{ 'customer.login.forgot_password' | t }}</a></p>
					{% endif %}
				</div>

				{% endform %}
			</div>

This check works correctly in the "register.liquid" file.

What am I doing wrong? I would be grateful for any help. Thanks!

Replies 2 (2)

omcpheely
Visitor
2 0 1

Hi @Svyatoslav,

Did you ever find a resolution for this? Seems like many people (including myself) have struggled with this, however I have never seen a definitive answer.

Thanks in advance,

Oliver. 

Svyatoslav
Tourist
10 1 2

Hey! I haven't yet found a solution to the problem. I left everything as it is.