Myshop Javascript Library: Action Event Listener

The default myshop js library exposes an object which can be used to subscribe to the default myshop actions, such as page navigation.
In the example shown below a listener for the myshop-action:next-page is registered. To register a handler for the onNext() event, supply the handler code to the function onNext() of the myshopEvent() instance. In the shown example an anonymous handler is registered.

The handler will check the “checked” state of the checkbox with the id “check”. If the checkbox is not checked a message is shown and the value “false” is returned. The return value “false” will stop the event chain, preventing the user from going to the next page in theis case. To continue the chain return “true”. To ensure the user can invoke a new next event (by pressing the next button again) the active lock must be cleared, using myshopEvent().clearLock().


    <!-- Sample next listener -->
    <script type="text/javascript">

            var oke=false,c=document.getElementById('check');
                alert("Please confirm the option by checking the checkbox.");
            return oke;


    <!-- Sample next button -->
    <a style="myshop-action:next-page">Go to the next page</a>

    <input type="check" name="check" id="check"/> Check me before continuing.


In the next table an overview of all the supported event handlers is shown. The handlers are registered in the same way as shown in the onNext() example. For every event handler returning a value “false” will stop the chain of events where as a value “true” will continue the event flow.

event value
myshopEvent().onNext(f) Register a handler for the myshop-action:next-page action in the order process.
myshopEvent().onPrevious(f) Register a handler for the myshop-action:previous-page action in the order process.
myshopEvent().onBack(f) Register a handler for the myshop-action:back action in the moreinfo page.
myshopEvent().onSearch(f) Register a handler for the myshop-action:search in the moreinfo page or productlist.
myshopEvent().onAddressType(f) Register a handler for the myshop-action:shipping-selection in the address page.
myshopEvent().onNotify(f) Register a handler for every notification issued by the server.


Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment