We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5894
    • 10 Posts
    Ive gone through examples of using &eFormOnBeforeFormParse and I thinktm I understand it.

    But Im still getting an error with an undefined function. Heres what Ive done.

    In my document for displaying a form I have:

    [[eFormEvents]]
    [!eForm? &formid=`RegisterForm` &subject=`[+subject+]` &to=`[email protected]` &tpl=`RegisterForm` &noemail=`1` &eFormOnBeforeFormParse='testtest' &thankyou=`RegisterFormReport`!]
    


    I have created a snippet called "eFormEvents" with the content:

    <?php
    //functions for eForm events
    function testtest(&$fields, &$templates) {
    return true;
    }
    ?>
    


    (keeping it simple to start with...)

    And then I have my chunk called "RegisterForm" which, when I remove the "&eFormOnBeforeFormParse=’testtest’" from the eForm snippet call, works fine.

    But with the &eFormOnBeforeFormParse=’testtest’ in there I get the dreaded

    Fatal error: Call to undefined function ’testtest’ () in /home/mysite/htdocs/assets/snippets/eform/eform.inc.php on line 138

    As far as I can see Ive got everything in there, thanks to the help Ive already received from the forum and the documentation. Ive got the snippet call in the document to the snippet with the testtest function, and then Ive got the snippet call to the eForm wich asks for the testtest function...

    What am I missing?
      • 5894
      • 10 Posts
      Solved.

      Just in case it happens to anyone else the problem was to do with the types of quotes used in the eForm snippet call.

      &eFormOnBeforeFormParse='testtest'

      doesnt work.

      &eFormOnBeforeFormParse=`testtest`

      does work.

      Thats taken me about 3 hours to work out... grumble...
        • 25663 MODX Staff
        • 12,272 Posts
        LOL ... that’s probably the #1 problem for any snippet (See the "my snippet doesn’t work" stickied in MODx101 topic). Single-quotes do not work for paramaters; they have to be backticks.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me