Solved

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

PonMaheswaran
Shopify Partner
29 4 5

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 Kerror1.png

Accepted Solutions (2)
IttantaTech
Shopify Partner
525 55 102

This is an accepted solution.

@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 %}
Thanks,
Ittanta Technologies Pvt. Ltd. | Shopify Expert
If reply is helpful, please Like and Accept Solution.
To hire us, contact us at info@ittanta.com

View solution in original post

bbnnhhnn
Tourist
3 1 3

This is an accepted solution.

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

View solution in original post

Replies 15 (15)

PonMaheswaran
Shopify Partner
29 4 5

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

 

bbnnhhnn
Tourist
3 1 3

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

IttantaTech
Shopify Partner
525 55 102

This is an accepted solution.

@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 %}
Thanks,
Ittanta Technologies Pvt. Ltd. | Shopify Expert
If reply is helpful, please Like and Accept Solution.
To hire us, contact us at info@ittanta.com
bbnnhhnn
Tourist
3 1 3

Thank you @IttantaTech! Worked perfectly.

IttantaTech
Shopify Partner
525 55 102

@bbnnhhnn 

Thanks 

Thanks,
Ittanta Technologies Pvt. Ltd. | Shopify Expert
If reply is helpful, please Like and Accept Solution.
To hire us, contact us at info@ittanta.com
HC5
Tourist
14 0 1

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!

IttantaTech
Shopify Partner
525 55 102

@HC5 

Yes, can you please try some way

Thanks,
Ittanta Technologies Pvt. Ltd. | Shopify Expert
If reply is helpful, please Like and Accept Solution.
To hire us, contact us at info@ittanta.com
HC5
Tourist
14 0 1

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!

IttantaTech
Shopify Partner
525 55 102

@HC5 

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

Thanks,
Ittanta Technologies Pvt. Ltd. | Shopify Expert
If reply is helpful, please Like and Accept Solution.
To hire us, contact us at info@ittanta.com
HC5
Tourist
14 0 1

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.

HC5
Tourist
14 0 1

The password to enter my store is fraily .

Sambdev
Shopify Partner
11 0 0

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-f...

Sam Bruton
Frontend Web Developer
https://www.thefrontendist.com
PonMaheswaran
Shopify Partner
29 4 5

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

bbnnhhnn
Tourist
3 1 3

This is an accepted solution.

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

PonMaheswaran
Shopify Partner
29 4 5

Dear @bbnnhhnn ,

Thank you very much  for your help.

It is working as expected.

 

I am accepting this as solution.

 

Regards,

Pon.