Form.errors display in both login form and create account form

Dear all,

I am working on my own shopify store, i which i have Login form and Create account form in same page.(Side by side).

When i give correct/proper user name and password, i am able to login and create new account. But if i enter wrong password or user name in login form, the error message is displaying in both the forms as shown in image.

Please guide me, how to stop this and i should get error message only for respective form.

My store URL as follows:

https://famzon-development.myshopify.com/account/login

Please help me.!

Regards,

Pon maheswaran K

Hello @shopify Gurus,

I am requesting you to show or provide me the documents/API/Methods regarding handling multiple forms and their errors in same page.

Please do the support for your user.

Regards,

Pon maheswaran K

Hi Pon, I’m experiencing the same issue. How were you able to resolve this? Thanks in advance.

1 Like

@bbnnhhnn

please update this code error code like

{% unless template.name == 'register' %}
  {{ form.errors | default_errors }}
{% endunless %}

{% unless template.name == 'login' %}
  {{ form.errors | default_errors }}
{% endunless %}
5 Likes

Thank you @IttantaTech ! Worked perfectly.

1 Like

@bbnnhhnn

Thanks

1 Like

Dear @bbnnhhnn ,

we have fixed this issue partially by following method.

We have kept same copy of code i login.liquid and register.liquid.

In login.liquid file we removed the error handling for create_customer form and in register.liquid, removed error handling for customer_login form.

Because of this if any error happened in login form, will not reflect in register form and same vice versa.

And please confirm, where(In which file) did you paste the code given by @IttantaTech ?

Thanks in advance.

Regards,

Pon maheswaran K

Hi Pon,

I adjusted the code accordingly as follows:

{% form 'customer_login' %}

  {% unless template.name == 'register' %}
    {{ form.errors | default_errors }}
  {% endunless %}

  [...]

{% endform %}

and

{% form 'create_customer' %}

  {% unless template.name == 'login' %}
    {{ form.errors | default_errors }}
  {% endunless %}

  [...]

{% endform %}

Let me know if that helps.

Best

1 Like

Dear @bbnnhhnn ,

Thank you very much for your help.

It is working as expected.

I am accepting this as solution.

Regards,

Pon.

1 Like

Hello @IttantaTech , would you be able to help with a similar problem?

My footer newsletter signup is directly below my contact page. When I input an invalid email address for either one of them, the error message shows up for both. How do I get it to show up only for the part of the page I’m inputting an invalid email into?

I’m using the Debut theme and I’m still on the free trial.

Thanks so much!

@HC5

Yes, can you please try some way

Hello, sorry I’m not sure I understand what you mean by please try some way. I’m not a developer and I don’t know code. Would you be able to help me solve my problem?

Thanks again!

@HC5

Please give your store access. to check this and provide solution. I have sent store access request from our Shopify Partner account.

Hello, I don’t see your collaborator request in my dashboard. Did you maybe send an access request to the wrong shop? My shop is just-skin-co.myshopify.com.

The password to enter my store is fraily .

Do you have a solution for when multiple forms are within the same page template?

https://community.shopify.com/c/technical-q-a/handling-form-errors-on-a-page-with-multiple-contact-forms/td-p/2026618