We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45529
    • 11 Posts
    Hello I have an odd issue with a snippet not being parsed in modx revolution 2.2 -

    The page has 3 different contact us forms on a single a page (quite unusual but its a design requirement) to begin with all 3 contact us forms were coming from a single snippet using &type but this was causing the form to be sent 3 times as when one submit button was clicked due to the same snippet being used it was sending a single form 3 times as it detected a submit being click and seemed to assume it was all forms.

    To work around this issue I am trying to separate the forms down into their own individual snippets, to do this I have duplicated the original snippet and amended the calls in the templates giving the new snippets names and changing the names of the types within the snippet, what seems to be happening is the new snippets are being ignored (checked source they are not being parsed when the page loads), example below -

    First contact form -

    <h1>[[*pagetitle]]</h1>
    [[*content]]
    <div id=contactGen class='contactus'>
    [[!contact? &type=`contact`]]
    </div>

    Second Contact form -

    <div id='topContact'>
    <h1>Or request a call back from us at your convinience </h1>
    <p>Simply enter your details below</p>
    [[!contactSidebar? &type=`callbackside`]] //was previously - [[!contact? &type=`callback`]]
    </div>

    The snippet in the second piece of code does not generate although the code is the same in the snippet except for the form type and name (which are correct in the call)

    I have manually cleared the cache - clear cache option from the menu doesn't seem to work.

    Does anyone know what the issue might be here - is there somewhere I need to set up some information about a new snippet so that it can be used in the template?
      • 45529
      • 11 Posts
      Just to clarify, does anyone know if there's any problems with the process of duplicating snippets -

      - Go to original snippet
      - Click duplicate
      - Give new snippet an appropriate name
      - Edit code in snippet
      - Click check box "Clear Cache on Save"
      - Save Snippet
      - Add query in correct format to template.

      This is the process I followed but none of the snippets I have created are generating the code when the page loads.
        • 3749
        • 24,544 Posts
        Try putting code like this at the top of each snippet:

        return '<p>In Snippet 1</p>';


        That will tell you if they're executing at all.

        The names of snippets are case-sensitive, so be sure you've named them correctly in the tags. Also, edit each snippet and re-type the name, making sure there are no spaces at the beginning or end.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting