We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29181
    • 480 Posts
    I would like to use a eform event. Something I have done in the past, but sometimes it just doesn’t work, and I can’t seem to tie down why.
    Calling
    [!fileUpload!][!eForm? &formid=`ContactForm` &replyto=`email` &subject=`[*pagetitle*]` &to=`[email protected]` &ccsender=`0` &tpl=`ContactForm` &report=`ContactFormReport` &invalidClass=`invalidValue` &vericode=`1` &requiredClass=`requiredValue` &cssStyle=`formStyles` &eFormOnBeforeMailSent=`checkMime` !]


    where fileUpload looks like:

    function checkMime (&$fields){
     return true;
    }


    should work?

    Taff
      Adrian Lawley: www.adrianlawley.com
      • 7231
      • 4,205 Posts
      try setting the first snippet to [[fileUpload]] (cached)
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 29181
        • 480 Posts
        Thanks, as always for your help dev!

        Unfortunately that helped none, but I think I have it now.
        The problem would appear to be that once a function wasn’t found, no matter what you change the name of the function to, or the snippet name, eForm will not find it unless....

        You call the eForm snippet like this:

        [[SnippetContainingMyFunction]]
        [!eForm?&parameters=`lots but no event call`!]

        so removing the event parameter, calling the page, then replacing it seems to work.

        Thanks for your help!

        Taff
          Adrian Lawley: www.adrianlawley.com
          • 7231
          • 4,205 Posts
          so removing the event parameter, calling the page, then replacing it seems to work.
          Interesting, this sounds like a cache issue of some sort. Maybe if we disable the document cache all together it will not have this effect.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 29181
            • 480 Posts
            So I came across the exactly the same problem on a different site today. I pulled and pulled at my hair, got really upset, and then:

            I noticed that I get that error if the snippet being called throws a parse error.

            Maybe this was the problem all along?!?

            Cheers,
            taff
              Adrian Lawley: www.adrianlawley.com
              • 6038
              • 228 Posts
              I had the same problem, and found that if i called the eFormEvent snippet uncached it solved the problem
              eg [!eFormEvent!]
              i think also it was because there was a parse error in the snippet, and i couldnt get round the fact the snippet had been read with the error and lodged in the cache. Once i fixed the snippet, it still didnt work - but once i called the eFormEvent uncached I was back in business.