Page go to top when the registration form is filled out incorrectly

  • Posts: 220
  • Thank you received: 12
3 years 4 months ago #333842

-- url of the page with the problem -- : www.dah01.jroot.layer3.co.uk/index.php/checkout
-- HikaShop version -- : 4.4.2
-- Joomla version -- : 3.9.26
-- PHP version -- : 5.6.40

Hello,

Is it possible to make the page go to the top when the registration form is filled out incorrectly. This is so the user can easily read what they did wrong - see attached.

Thanks,
Josh.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 4 months ago #333845

Hi,

That's already the case on your website.
If I don't fill anything on the registration form and click on the register button:
i.imgur.com/5azFlRD.png
I am automatically brought to the top of the login form with the error messages:
i.imgur.com/owsVend.png
That's a mechanism we've added in the HikaShop checkout specifically for that.
However, you have two problems on your website:
- Some of the error messages are green instead of red, and thus are not counted as errors by the system and thus it doesn't scroll up to them. That's something we've fixed on our end. It would require updating your HikaShop to get the patch for that.
- Your template has made its menu bar sticky to the top and thus the first 2 error messages are hidden below that menu bar. That's tricky to give a good solution to that. Scrolling to top might risk loosing the customer too as the top might be far from where the error message is. That's actually something we changed a few years ago to improve the checkout, especially on mobile devices.
Now if you really want to scroll to the top of the page in case of an error instead of scrolling to the error messages, you could change the code:

els[i].scrollIntoView('{block: "start"}');
(2 places) in the file media/com_hikashop/js/checkout.js to :
window.scrollTo(0, 0);
Note however that you'll loose the change when you update your HikaShop.

The following user(s) said Thank You: joshualdouglas

Please Log in or Create an account to join the conversation.

  • Posts: 220
  • Thank you received: 12
3 years 4 months ago #333874

Hi Nicolas,

Thanks for your detailed response. The code you have provided has fixed the issue.

However, I'm not sure what the disadvantages are in my instance. I can see any hidden messages under my header. Desktop or mobile.

Thanks,
Josh.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 4 months ago #333875

Hi,

The disadvantage of the code modification I propose is that after the customer validate the form, he goes at the top of the page. On mobile devices, with a small screen, the error messages won't be directly visible on the page and the customer might wonder what's going on. Without that modification, and without the 2 issues you have that I talked about in my previous message, the customer would be brought directly to the error messages, not the top.
On your website, this might be fine like this, but that's not something we want by default for everyone else.

The following user(s) said Thank You: joshualdouglas

Please Log in or Create an account to join the conversation.

  • Posts: 220
  • Thank you received: 12
3 years 4 months ago #333927

Thanks for this. I believe this is working fine on my website :)

Please Log in or Create an account to join the conversation.

  • Posts: 220
  • Thank you received: 12
3 years 4 months ago #334078

Hi,

I've upgraded to HikaShop Essential: 4.4.3 but I'm sadly still having problems with this. Even when changing the code as you mentioned above. It seems to be inconsistent. Sometimes it goes to the top and sometimes it doesn't.

This is my page with the issue - www.dah01.jroot.layer3.co.uk/index.php/checkout

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 4 months ago #334082

Hi,

I don't see that issue for now there.
However, if I go to your link and press the "register" button, I get a MySQL query error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY pp.pack_id ASC' at line 1
This seems to come from HikaSerial. So either you have an old version of HikaSerial you need to update there or there is a bug in HikaSerial.
If you have the latest version of HikaSerial already, you should activate the "error reporting" and "debug" settings of the Joomla configuration and try again to get more information about that error so that we can see what's going on.

The following user(s) said Thank You: joshualdouglas

Please Log in or Create an account to join the conversation.

  • Posts: 220
  • Thank you received: 12
3 years 4 months ago #334110

Hi,

It doesn't go to the top if you have a password that doesn't meet the requirements.

I have an error? I've been doing lots of testing and it seems to work fine. That's worrying.

I have the latest version of Hikashop and HikaSerial.

I sadly don't really have time to debug that error unless it becomes an issue which I don't think it is right now. Unless it's affecting the password above of course.

Thanks

Last edit: 3 years 4 months ago by joshualdouglas.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 4 months ago #334121

Hi,

Ok, I understand what you're saying. I was able to reproduce and made a patch so that the password errors display as errors, not warnings. That's why they weren't taken into account by the scroll mechanism.
I've added the patch to the HikaShop install package so you can download it on our website and install it on yours to get it. You'll have to reapply the modification to the javascript file.

Also regarding the MySQL query error, reading what you said, I suppose it's because the product I have in my cart has been deleted / modified / changed in some way. So I cleared by browser's cookies on your website and added a new product to the cart and went to the checkout and not error anymore.

The following user(s) said Thank You: joshualdouglas

Please Log in or Create an account to join the conversation.

  • Posts: 220
  • Thank you received: 12
3 years 4 months ago #334253

Ok thanks

Please Log in or Create an account to join the conversation.

Time to create page: 0.074 seconds
Powered by Kunena Forum