1

I have created custom success message which would be shown after the form submission. I have enabled full page cache is backend now that message is not showing.

So, I changed cachable="false" for that template but not working find the code below,

<body>
    <referenceContainer name="page.messages">
        <block class="Magento\Framework\View\Element\Messages" name="messages" as="messages"/>
    </referenceContainer>
    <referenceContainer name="content" cacheable="false">
        <block class="Customer\Form\Block\Index\Form" name="form_index_form" template="Customer_Form::form_index_form.phtml"/>
    </referenceContainer>
</body>
1

1 Answer 1

4
try below code,changed is only adding cacheable="false" in block 

<body>
    <referenceContainer name="page.messages">
        <block class="Magento\Framework\View\Element\Messages" name="messages" as="messages"/>
    </referenceContainer>
    <referenceContainer name="content">
        <block class="Customer\Form\Block\Index\Form" name="form_index_form" template="Customer_Form::form_index_form.phtml" cacheable="false" />
    </referenceContainer>
</body>

Hope it will help you.

Also read Magento Doc http://devdocs.magento.com/guides/v2.2/extension-dev-guide/cache/page-caching/public-content.html

3

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.