We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30912
    • 463 Posts
    Were rebuilding a website in Evolution for a client and thus need to use Evolution.

    Ive set up a form for their brochure download and newsletter signup.

    The issue is i need to send them to a different thank you page if they choose a printed brochure (based on a checkbox)

    So far i have followed this thread: http://forums.modx.com/index.php?topic=32812.0.

    My form and snippets are as follows:

    
    <p class="error">[+validationmessage+]</p>
    <form action="[~[*id*]~]" method="post" enctype="multipart/form-data" id="ContactForm">
      <input name="formid" type="hidden" value="ContactForm" />
      <ul>
     <li>
         *Indicates required fields
        </li>
        <li>
          <label for="cfName">Your First name*:</label>
          <input name="firstname" id="cfFirstName" class="text" type="text" eform="Your First Name::1:" />
        </li>
        <li>
          <label for="cfSurName">Your Surname*:</label>
          <input name="surname" id="cfSurName" class="text" type="text" eform="Your Surname::1:" />
        </li>
        <li>
          <label for="cfEmail">Your Email Address*:</label>
          <input name="email" id="cfEmail" class="text" type="text" eform="Email Address:email:1" />
        </li>
        <li>
          <label for="cfHouseNo">House Name/Number:</label>
          <input name="houseno" id="cfHouseNo" class="text" type="text" eform="Your House Number::0" />
        </li>
        <li>
          <label for="cfStreet">Street:</label>
          <input name="street" id="cfStreet" class="text" type="text" eform="Your Street Name::0" />
        </li>
        <li>
          <label for="cfTown">Town:</label>
          <input name="town" id="cfEmail" class="text" type="text" eform="Your Town::0" />
        </li>
        <li>
          <label for="cfCounty">County:</label>
          <input name="county" id="cfCounty" class="text" type="text" eform="Your County::0" />
        </li>
        <li>
          <label for="cfPostcode">Postcode:</label>
          <input name="postcode" id="cfPostcode" class="text" type="text" eform="Your Postcode::0" />
        </li>
        <li>
          <label for="cfCountry">Country:</label>
          <input name="country" id="cfCountry" class="text" type="text" eform="Your Country::0" />
        </li>
        <li> <strong> Note:</strong> full address required for posted brochure requests! </li>
        <li>
          <label for="cfTelNo">Daytime Telephone:</label>
          <input name="telno" id="cfTelNo" class="text" type="text" eform="Your Telephone Number::0" />
        </li>
       
        <li>
        <label for="cfNeeds">Particular Needs:</label>
        <textarea name="needs" rows="5" id="cfNeeds" eform="Particular Needs:textarea:0"></textarea>
        </li>
        <li>
          <label for="cfByPost">Please send me a printed brochure by post:</label>
          <input type="checkbox" value="1"  id="bypost" name="bypost" eform="Brochure By Post::0" />
        </li>
        <li>
          <label for="cfSubscribe">Subscribe to e-mail newsletters:</label>
          <input type="checkbox" value="1" id="subscribe" name="subscribe"  eform="Subscribe to Newsletters?::0"/>
        </li>
        <li>
          <input type="submit" name="contact" id="cfContact" class="button" value="Submit" />
        </li>
      </ul>
    </form>
    


    thankYouRedirect

    <?php
    function onMailSentEvent(&$fields){
       global $modx;
       switch($fields['bypost']){
          case '1':
             $id = 216;
             break;
          
          default:
             $id = 215;
       }
       $modx->sendRedirect($modx->makeUrl($id, '', '', 'full'));
    }
    ?>


    And Eform call:

    [!eForm? &formid=`ContactForm`&to=`[email protected]` &tpl=`BrochureDL` &report=`BrochureDLReport`  &vericode=`0` &subject=`Brochure Download` &eFormOnBeforeMailSent=`eForm2db` &eFormOnMailSent=`onMailSentEvent` !]


    But everythime i submit the form it just goes to a blank page - the form is processed, as it submits to the database via eform2db.

    Any ideas?
      • 19369
      • 1,098 Posts
      Stupid question: do you have the snippet "thankYouRedirect" before the eForm call?
        • 30912
        • 463 Posts
        might help if id said that, i have:

        [[thankYouRedirect]]


        perhaps it should be uncached?
          • 36551
          • 416 Posts
          I have a question that is a variation of this.

          I have a client that would like to tailor the email response from their contact form based on the topic they choose in a pull down.

          We'll need an easy way for the client to update the response content. So I was thinking we could create a set of TVs on the form page that contain the custom response content. Then put an output modifier on a placeholder in the emailtpl that would do something like, if topic one choose TV2, if topic two choose TV2, etc. There would be five to ten topic and response choices.

          Would this work? What would the placeholder output modifier look like?

          Would this have to be done via snippet? (my php knowledge is pretty low).

          Thank you!

          We're using Revo 2.2.2
            • 19369
            • 1,098 Posts
            Quote from: Tyreal2012 at Apr 16, 2012, 11:38 AM
            might help if id said that, i have:

            [[thankYouRedirect]]


            perhaps it should be uncached?

            Sorry I didn't see your reply, I think you should have both the snippet and eForm uncached.
              • 19369
              • 1,098 Posts
              Quote from: terrybarth at May 24, 2012, 02:46 PM
              We're using Revo 2.2.2

              This thread is about eForm, a snippet for MODX Evolution, ask this question on FormIt forum, FormIt is a similar snippet for MODX Revolution.
                • 36551
                • 416 Posts
                Will do.

                Thanks.