We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6852
    • 39 Posts
    Hi,

    so i have a form on one page that i want to copy the value of its input forms into a snippet i have created. and then i can re-use this information later on when i want..

    so i was thinking along the lines of:
    [!my_miniFormSnippet? &rnMyEmail=`Email`!]

    to call my snippet


    where Email is the name of the output field in my form


    and my snippet uses
    $modx->setPlaceholder('rnMyEmail', $rnMyEmail);
    echo $rnMyEmail;
    return;
    

    to store and return my variable(using [+rnMyEmail+])
    to add the variable anywhere i want using


    now i know this code wont work because all it does is pass the text ’Email’, i have been playing around with different variations without success.

    so what im wondering is how can i pass the value of the input field(called Email) that is in a html form(called ’MyForm’) to my snippet


    hope this makes sense what im trying to do
      • 32699 ☆ A M B ☆
      • 427 Posts
      Might I suggest eform.


      It is made to do this sort of thing.
        Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

        Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
        • 7231
        • 4,205 Posts
        The same way you would normally do it outside of modx. If the form is using post then you have a snippet with $_POST[’myEmail’]

        <?php
        $output = isset($_POST[’myEmail’]) ? $_POST[’myEmail’] : ""’
        return $output;
        ?>


        eForm is a powerful snippet for sending mail and there is also SPForm which is more for contact forms but has great anti spam. So if the objective is to send an email you may want to look into these snippets, but nothing keeps you from doing it yourself with your own mail() call or even using a custom mail class. Can too much freedom be a bad thing? grin grin
          [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]