1

I am using Magento 2. I am trying to display magento notifications on the page of custom module. I have followed these posts: How to show session messages at front end in magento 2 beta How to use messageManager to show an error after redirect How to show success message in session Magento2

I am using messageManager and message block is being rendered in the page, but messages are still not displayed. While these messages (that I add) are displayed in regular magento page.

I notice that scripts messages.js and messageList.js are not present in the page. Does it have anything to do with that? If yes how to add them?

3
  • <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <title>Test</title> </head> <body> <referenceContainer name="page.messages"> <block class="Magento\Framework\View\Element\Messages" name="messages" as="messages" template="Magento_Theme::messages.phtml"/> </referenceContainer> </body> </page>
    – Jackson
    Commented Mar 16, 2017 at 9:56
  • this is my layout file <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="page.messages"> <block class="Magento\Framework\View\Element\Template" name="ajax.message.placeholder" template="Magento_Theme::html/messages.phtml"/> <block class="Magento\Framework\View\Element\Messages" name="messages" as="messages" template="Magento_Theme::messages.phtml"/> </referenceContainer> Commented Mar 16, 2017 at 9:59
  • as you can see the block is there and it is also present in the web page Commented Mar 16, 2017 at 10:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.