We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13836
    • 7 Posts
    Looking for some assistance in using eform and a snippet. I’m trying to call an event using eform’s OnBeforeFormMerge. "myTest" is a function in the "formToggle" snippet. Here is the code in my page:

    [!formToggle!]
    
    [!eForm? &formid=`projectForm` &to=`[email protected]` &tpl=`eProjectForm` &report=`eContactFormEmail` &thankyou=`eContactFormThanks` &vericode=`1` &subject=`New Project Request` &eFormOnBeforeFormMerge=`myTest` !]
    


    Here is the code in the formToggle snippet. It doesn’t do anything yet because eForm is telling my myTest is an unknown function. It’s the same error you get when you try to run a function from another script which you haven’t included yet in PHP.

    <?php
    function myTest (&$fields) {
    return true;
    }
    ?>
    


    Any ideas?
      • 7231
      • 4,205 Posts
      Try with cached snippet call for the event snippet:

      [[formToggle]]
        [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&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 13836
        • 7 Posts
        No difference, the error is still:

        Fatal error: Call to undefined function: mytest()
          • 34017
          • 898 Posts
          edit: if it says ’Fatal error: Call to undefined function: mytest()’, then try renaming the function to my_test() and changing the event param the same.

          1. Is the page cached? Try uncaching it.

          2. add an echo to myTest function and call it by itself on a page to test it

          3. have myTest print_r the $fields

          4. try calling formToggle with [!formToggle? !] (add the ? after it)
            Chuck the Trukk
            ProWebscape.com :: Nashville-WebDesign.com
            - - - - - - - -
            What are TV's? Here's some info below.
            http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
            http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
            • 13836
            • 7 Posts
            Arrg! I don’t think I EVER would have thought of caching being the issue. I turned off the ’cachable’ option in ’Page Settings’ and it’s good to go. Thanks.
              • 13836
              • 7 Posts
              Ok, next question is, how do I set a placeholder when I’m using eForm? I’m using an event as you can see in the above code, but in my snippet, when i call the setPlaceholder() function, my chunk isn’t reflecting the placeholder. I also need to set more than one placeholder so I think I need to use another strategy other than returning the $modx object but I’m not sure how to do it. Here is the code:

              function detectForm ( &$fields ) {
                // set the placeholders
                global $modx;
                return $modx->setPlaceholder('contactdisplaystatus','style="display:none"');
              }
              
                • 34017
                • 898 Posts
                What exactly are you trying to do? Because you might not need to set a placeholder.

                In MODx 96, if somethings not working- check the cache, then check ` ? and other input errors. Those 2 things will get it 90% o the time.
                  Chuck the Trukk
                  ProWebscape.com :: Nashville-WebDesign.com
                  - - - - - - - -
                  What are TV's? Here's some info below.
                  http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
                  http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
                  • 13836
                  • 7 Posts
                  I’m trying to set placeholders which contain the HTML to hide/display specific forms on my page. This way I can control which forms are shown or hidden for the error and thank you pages in eForm. It really all stems from a JS effect I’m using on the page which hides and displays forms based on a radio button click.

                  Not sure what you mean by `?
                    • 4310
                    • 2,310 Posts
                    Not sure what you mean by `?
                    I think ProWebscape is saying check you are using ` (backticks) and ? (question mark) in your snippet call i.e.
                    [[MySnippet? &param=`1`]]
                      • 34017
                      • 898 Posts
                      Quote from: bunk58 at Jun 01, 2008, 04:41 PM

                      I think ProWebscape is saying check you are using ` (backticks) and ? (question mark) in your snippet call i.e.
                      [[MySnippet? &param=`1`]]


                      Bunk is correct.

                      So let me get this straight (im being a dunce today). You have 4 forms. You want the user to:
                      1. submit the first form
                      2. check validation per your snippet and show the second form
                      3. repeat for next forms

                      Is that correct?


                        Chuck the Trukk
                        ProWebscape.com :: Nashville-WebDesign.com
                        - - - - - - - -
                        What are TV's? Here's some info below.
                        http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
                        http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008