[Skip to main content](#vessel-content)

#   Checkout form submit

##

- **[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")**
- [![kyratn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/redswirl.jpg)](/forum/user/38342-kyratn "View kyratn's Profile") Topic Author
- [ Offline](/forum/user/38342-kyratn)

Less More

- Posts: 1119
- Thank you received: 114
-
- [](http://kyra.lt)
-

8 years 1 month ago [\#299427](#299427) by [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")  *[Checkout form submit](/forum/27-checkout/896017-checkout-form-submit#299427 "-- HikaShop version -- : 1810220946  Hi,  We have intergrated jquery validation plugin to validate form fields. All works fine everwhere except checkout guest/address block.  The issue is that on focusing any input and pressing keyboard &quot;enter&quot; or mobile browser &quot;go&quot;, the address block is submited those bypassing validation plugin. I also have tried in HikaShop » User addresses menu item which has now ajax submit and there is no such issue.  So before applying any changes to validation plugin it self, is there a way to avoid such behiviour on hikashop level? Basically i am looking for the part of the code which gives such undesired effect.  For sure tried with protostar template without any modifications and it has same behiviour on checkout as well.  Any help would be appreciated.  Thank you")* was created by *[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")*

-- HikaShop version -- : 1810220946

Hi,

We have intergrated jquery validation plugin to validate form fields. All works fine everwhere except checkout guest/address block.

The issue is that on focusing any input and pressing keyboard "enter" or mobile browser "go", the address block is submited those bypassing validation plugin. I also have tried in HikaShop » User addresses menu item which has now ajax submit and there is no such issue.

So before applying any changes to validation plugin it self, is there a way to avoid such behiviour on hikashop level?
Basically i am looking for the part of the code which gives such undesired effect.

For sure tried with protostar template without any modifications and it has same behiviour on checkout as well.

Any help would be appreciated.

Thank you

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjAxNy1jaGVja291dC1mb3JtLXN1Ym1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

8 years 1 month ago -  8 years 1 month ago [\#299433](#299433) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Checkout form submit](/forum/27-checkout/896017-checkout-form-submit#299433 "-- HikaShop version -- : 1810220946  Hi,  We have intergrated jquery validation plugin to validate form fields. All works fine everwhere except checkout guest/address block.  The issue is that on focusing any input and pressing keyboard &quot;enter&quot; or mobile browser &quot;go&quot;, the address block is submited those bypassing validation plugin. I also have tried in HikaShop » User addresses menu item which has now ajax submit and there is no such issue.  So before applying any changes to validation plugin it self, is there a way to avoid such behiviour on hikashop level? Basically i am looking for the part of the code which gives such undesired effect.  For sure tried with protostar template without any modifications and it has same behiviour on checkout as well.  Any help would be appreciated.  Thank you")*

Hi,

There is no way to avoid that. It's done on purpose thanks to the handleEnter function in the file media/com_hikashop/js/checkout.js so that when you use the enter key it submits the block.
However, your issue brings a good point.
I've just added on our end a trigger checkoutBlockSubmit that you can register to add checks before the block data is sent in AJAX.
You can first download again the install package on our website and install it on yours to get the patch to the checkout javascript to handle that new trigger event.
Then, you can do like that in your JS: Code:

window.Oby.registerAjax(['checkoutBlockSubmit'], function(type, cid, pos, element){ // my checks on the form if(error_in_the_form){ alert('there is an error'); return true; } });

Last edit: 8 years 1 month ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

The following user(s) said Thank You: [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjAxNy1jaGVja291dC1mb3JtLXN1Ym1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")**
- [![kyratn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/redswirl.jpg)](/forum/user/38342-kyratn "View kyratn's Profile") Topic Author
- [ Offline](/forum/user/38342-kyratn)

Less More

- Posts: 1119
- Thank you received: 114
-
- [](http://kyra.lt)
-

8 years 1 month ago [\#299455](#299455) by [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")  Replied by *[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")* on topic *[Checkout form submit](/forum/27-checkout/896017-checkout-form-submit#299455 "-- HikaShop version -- : 1810220946  Hi,  We have intergrated jquery validation plugin to validate form fields. All works fine everwhere except checkout guest/address block.  The issue is that on focusing any input and pressing keyboard &quot;enter&quot; or mobile browser &quot;go&quot;, the address block is submited those bypassing validation plugin. I also have tried in HikaShop » User addresses menu item which has now ajax submit and there is no such issue.  So before applying any changes to validation plugin it self, is there a way to avoid such behiviour on hikashop level? Basically i am looking for the part of the code which gives such undesired effect.  For sure tried with protostar template without any modifications and it has same behiviour on checkout as well.  Any help would be appreciated.  Thank you")*

Hi.

I saw that my issue probably comes from checkout.js file. That's why i created this topic.

Thank you for the new trigger. This now makes things simpler ![:)](/media/kunena/emoticons/3.png ":)")

Kind regarss

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjAxNy1jaGVja291dC1mb3JtLXN1Ym1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")**
- [![kyratn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/redswirl.jpg)](/forum/user/38342-kyratn "View kyratn's Profile") Topic Author
- [ Offline](/forum/user/38342-kyratn)

Less More

- Posts: 1119
- Thank you received: 114
-
- [](http://kyra.lt)
-

7 years 1 month ago [\#312567](#312567) by [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")  Replied by *[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")* on topic *[Checkout form submit](/forum/27-checkout/896017-checkout-form-submit#312567 "-- HikaShop version -- : 1810220946  Hi,  We have intergrated jquery validation plugin to validate form fields. All works fine everwhere except checkout guest/address block.  The issue is that on focusing any input and pressing keyboard &quot;enter&quot; or mobile browser &quot;go&quot;, the address block is submited those bypassing validation plugin. I also have tried in HikaShop » User addresses menu item which has now ajax submit and there is no such issue.  So before applying any changes to validation plugin it self, is there a way to avoid such behiviour on hikashop level? Basically i am looking for the part of the code which gives such undesired effect.  For sure tried with protostar template without any modifications and it has same behiviour on checkout as well.  Any help would be appreciated.  Thank you")*

Hi,

I am trying to change some behavior in checkout with jQuery validation plugin...

The issue is that when i try to validate address block, i am not able to change guest information ( trying to press button 'change" will return erros in address block ), until address is validated. It seems that "checkoutBlockSubmit" is registering all checkout blocks... Is there a way to check which block you are submiting? So i could have different rules for it?

The code looks like this:
Code:

$("#hikashop_checkout_form").validate({ rules: { "data[register][email]": { required: { depends:function(){ $(this).val($.trim($(this).val())); return true; } }, lowAllLetters: true, email: true }, "data[address_1_4][address_firstname]": { required: true, capFirstStringLetter: true, minlength: 3 } }, messages: { "data[register][email]": "error email", "data[address_1_4][address_firstname]": "error name", }, errorElement: "div", errorPlacement: function ( error, element ) { error.addClass( "invalid-feedback" ); error.insertAfter( element ); }, highlight: function ( element, errorClass, validClass ) { $(element).addClass( "is-invalid" ); }, unhighlight: function (element, errorClass, validClass) { $(element).removeClass( "is-invalid" ); } }); window.Oby.registerAjax(['checkoutBlockSubmit'], function(type, cid, pos, element){ if (!$("#hikashop_checkout_form").valid()) { return true; } });

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjAxNy1jaGVja291dC1mb3JtLXN1Ym1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

7 years 1 month ago [\#312585](#312585) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Checkout form submit](/forum/27-checkout/896017-checkout-form-submit#312585 "-- HikaShop version -- : 1810220946  Hi,  We have intergrated jquery validation plugin to validate form fields. All works fine everwhere except checkout guest/address block.  The issue is that on focusing any input and pressing keyboard &quot;enter&quot; or mobile browser &quot;go&quot;, the address block is submited those bypassing validation plugin. I also have tried in HikaShop » User addresses menu item which has now ajax submit and there is no such issue.  So before applying any changes to validation plugin it self, is there a way to avoid such behiviour on hikashop level? Basically i am looking for the part of the code which gives such undesired effect.  For sure tried with protostar template without any modifications and it has same behiviour on checkout as well.  Any help would be appreciated.  Thank you")*

Hi,

Yes, the trigger checkoutBlockSubmit is used for each and every view where you can submit some information.
So you need to use the variables type cid and pos to check whether you want to do your checks.

The following user(s) said Thank You: [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjAxNy1jaGVja291dC1mb3JtLXN1Ym1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")**
- [![kyratn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/redswirl.jpg)](/forum/user/38342-kyratn "View kyratn's Profile") Topic Author
- [ Offline](/forum/user/38342-kyratn)

Less More

- Posts: 1119
- Thank you received: 114
-
- [](http://kyra.lt)
-

7 years 1 month ago [\#312630](#312630) by [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")  Replied by *[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")* on topic *[Checkout form submit](/forum/27-checkout/896017-checkout-form-submit#312630 "-- HikaShop version -- : 1810220946  Hi,  We have intergrated jquery validation plugin to validate form fields. All works fine everwhere except checkout guest/address block.  The issue is that on focusing any input and pressing keyboard &quot;enter&quot; or mobile browser &quot;go&quot;, the address block is submited those bypassing validation plugin. I also have tried in HikaShop » User addresses menu item which has now ajax submit and there is no such issue.  So before applying any changes to validation plugin it self, is there a way to avoid such behiviour on hikashop level? Basically i am looking for the part of the code which gives such undesired effect.  For sure tried with protostar template without any modifications and it has same behiviour on checkout as well.  Any help would be appreciated.  Thank you")*

Hi,

Thanks Nicolas, i have manage to do what i need. However i found some kinda issue with the trigger while doing my customization.

The issue.

While in edit address mode, clearing any address input and pressing ok button will trigger error on that input and it is fine, but after this, i am not able to finish the checkout or go to next step. It's just nothing happens... The "hikabtn_checkout_next" seems doesn't work anymore until i refresh page...

There is no such issue if error is triggered with "Enter" key, it only effects the "ok" button of address block and only after pressing it and triggering the error...

Fixed it with removing the line "onsubmit="if(window.checkout.onFormSubmit){ return window.checkout.onFormSubmit(this); }" inside checkout show.php

So question: Is this me or it could be that the issue is with the trigger?

I lack of knowledge to understand so thought will let you know.

Kind Regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjAxNy1jaGVja291dC1mb3JtLXN1Ym1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

7 years 1 month ago [\#312647](#312647) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Checkout form submit](/forum/27-checkout/896017-checkout-form-submit#312647 "-- HikaShop version -- : 1810220946  Hi,  We have intergrated jquery validation plugin to validate form fields. All works fine everwhere except checkout guest/address block.  The issue is that on focusing any input and pressing keyboard &quot;enter&quot; or mobile browser &quot;go&quot;, the address block is submited those bypassing validation plugin. I also have tried in HikaShop » User addresses menu item which has now ajax submit and there is no such issue.  So before applying any changes to validation plugin it self, is there a way to avoid such behiviour on hikashop level? Basically i am looking for the part of the code which gives such undesired effect.  For sure tried with protostar template without any modifications and it has same behiviour on checkout as well.  Any help would be appreciated.  Thank you")*

Hi,

There is no issue with the trigger.
You need to look at the code of the function setLoading in media/com_hikashop/js/checkout.js
You'll see this: Code:

setLoading: function(el, load) { var w = window, o = w.Oby, t = this, d = document, btn = d.getElementById('hikabtn_checkout_next'); if(el) { if(load) o.addClass(el, "hikashop_checkout_loading"); else o.removeClass(el, "hikashop_checkout_loading"); } if(load) t.loading++; else if(t.loading &gt; 0) t.loading--; // we block the next button while blocks are being submitted to avoid wrong actions to be validated while finishing the checkout if(btn) { if(t.loading) { btn.disabled = true; o.addClass(btn, 'next_button_disabled'); } else { btn.disabled = false; o.removeClass(btn, 'next_button_disabled'); } } }

As you can see, there is a mechanism to prevent the users from using the next button while blocks are being submitted.
So if the btn.disabled variable is not set back to true, the next button won't work.
In the submitBlock function, there is a call to t.setLoading(el, false); to reset the next button state after an AJAX call so that the next button can be used again after the block is submit.
But I suppose that the code you have somehow skips resetting the state of the next button.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjAxNy1jaGVja291dC1mb3JtLXN1Ym1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.065 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
