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

#   Intercept "next page" on checkout for custom plugin.

##

- **[raphaelr@alkaonline.be](/forum/user/39505-raphaelr-alkaonline-be "View raphaelr@alkaonline.be's Profile")**
- [![raphaelr@alkaonline.be's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/39505-raphaelr-alkaonline-be "View raphaelr@alkaonline.be's Profile") Topic Author
- [ Offline](/forum/user/39505-raphaelr-alkaonline-be)

Less More

- Posts: 12
- Thank you received: 0
-
-

7 years 11 months ago [\#301228](#301228) by [raphaelr@alkaonline.be](/forum/user/39505-raphaelr-alkaonline-be "View raphaelr@alkaonline.be's Profile")  *[Intercept "next page" on checkout for custom plugin.](/forum/31-development/896378-intercept-next-page-on-checkout-for-custom-plugin#301228 "Hello everybody. I am currently creating a plugin for hikashop.  During the checkout process I added some fields dynamically with onCheckoutStepDisplay and onCheckoutStepList.  My fields are correctly created and works well. But if the fields are not filled I would like to make an alert to the customer before he goes to the next checkout step. Something &quot;are you sure you didn't want to blablabla...&quot;.  I tried to &quot;intercept&quot; the submit of the form (the checkout is not in ajax on the website I am working on) but the event.prenventDefault() doesn't work. So I made some research and found that there's something to do with window.Oby but I can't find what to do and if this is compatible without using the ajax checkout.  Please I need some help. Best regards.")* was created by *[raphaelr@alkaonline.be](/forum/user/39505-raphaelr-alkaonline-be "View raphaelr@alkaonline.be's Profile")*

Hello everybody.
I am currently creating a plugin for hikashop.

During the checkout process I added some fields dynamically with onCheckoutStepDisplay and onCheckoutStepList.

My fields are correctly created and works well. But if the fields are not filled I would like to make an alert to the customer before he goes to the next checkout step. Something "are you sure you didn't want to blablabla...".

I tried to "intercept" the submit of the form (the checkout is not in ajax on the website I am working on) but the event.prenventDefault() doesn't work.
So I made some research and found that there's something to do with window.Oby but I can't find what to do and if this is compatible without using the ajax checkout.

Please I need some help.
Best regards.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg5NjM3OC1pbnRlcmNlcHQtbmV4dC1wYWdlLW9uLWNoZWNrb3V0LWZvci1jdXN0b20tcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86324
- Thank you received: 14286
-
-

7 years 11 months ago [\#301231](#301231) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Intercept "next page" on checkout for custom plugin.](/forum/31-development/896378-intercept-next-page-on-checkout-for-custom-plugin#301231 "Hello everybody. I am currently creating a plugin for hikashop.  During the checkout process I added some fields dynamically with onCheckoutStepDisplay and onCheckoutStepList.  My fields are correctly created and works well. But if the fields are not filled I would like to make an alert to the customer before he goes to the next checkout step. Something &quot;are you sure you didn't want to blablabla...&quot;.  I tried to &quot;intercept&quot; the submit of the form (the checkout is not in ajax on the website I am working on) but the event.prenventDefault() doesn't work. So I made some research and found that there's something to do with window.Oby but I can't find what to do and if this is compatible without using the ajax checkout.  Please I need some help. Best regards.")*

Hi,

If you implement the onAfterCheckoutStep trigger [ www.hikashop.com/support/documentation/6...#onAfterCheckoutStep](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#onAfterCheckoutStep) in your plugin.
There, check if the data is there, and if not set the variable $go_back to true and the user won't be able to go to the next step.
You can also use the $app-&gt;enqueueMessage() function of Joomla to display a message to the user.

Now that's in PHP.
If you also want to do a similar check in javascript, you can redefine the window.checkout.onFormSubmit function like that: Code:

window.checkout.onFormSubmit = function(form) { // your code // return false if you don't want the form to submit. }

That will be triggered when you click on the "next" button of each step of your checkout.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg5NjM3OC1pbnRlcmNlcHQtbmV4dC1wYWdlLW9uLWNoZWNrb3V0LWZvci1jdXN0b20tcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[raphaelr@alkaonline.be](/forum/user/39505-raphaelr-alkaonline-be "View raphaelr@alkaonline.be's Profile")**
- [![raphaelr@alkaonline.be's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/39505-raphaelr-alkaonline-be "View raphaelr@alkaonline.be's Profile") Topic Author
- [ Offline](/forum/user/39505-raphaelr-alkaonline-be)

Less More

- Posts: 12
- Thank you received: 0
-
-

7 years 10 months ago -  7 years 10 months ago [\#301287](#301287) by [raphaelr@alkaonline.be](/forum/user/39505-raphaelr-alkaonline-be "View raphaelr@alkaonline.be's Profile")  Replied by *[raphaelr@alkaonline.be](/forum/user/39505-raphaelr-alkaonline-be "View raphaelr@alkaonline.be's Profile")* on topic *[Intercept "next page" on checkout for custom plugin.](/forum/31-development/896378-intercept-next-page-on-checkout-for-custom-plugin#301287 "Hello everybody. I am currently creating a plugin for hikashop.  During the checkout process I added some fields dynamically with onCheckoutStepDisplay and onCheckoutStepList.  My fields are correctly created and works well. But if the fields are not filled I would like to make an alert to the customer before he goes to the next checkout step. Something &quot;are you sure you didn't want to blablabla...&quot;.  I tried to &quot;intercept&quot; the submit of the form (the checkout is not in ajax on the website I am working on) but the event.prenventDefault() doesn't work. So I made some research and found that there's something to do with window.Oby but I can't find what to do and if this is compatible without using the ajax checkout.  Please I need some help. Best regards.")*

Thanks for your answer.
It's the javascript side that I needed.

I'll make some tests

Last edit: 7 years 10 months ago by [raphaelr@alkaonline.be](/forum/user/39505-raphaelr-alkaonline-be "View raphaelr@alkaonline.be's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg5NjM3OC1pbnRlcmNlcHQtbmV4dC1wYWdlLW9uLWNoZWNrb3V0LWZvci1jdXN0b20tcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) 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.106 seconds

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