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

    Is there a way I can access/modify the value of the &gotoid parameter on event?

    Thx
      • 30223
      • 1,010 Posts
      No, but you can emulate the goto functionality in an event as a workaround.
      Use something like this in your eForm event function.

      <?php
      $modx->sendRedirect($modx->makeUrl($whatever_document_id);
      ?>
        • 5340
        • 1,624 Posts
        In case somebody else needs this here is the solution

        put this in your eform call

        &eFormOnMailSent=`goToAnotherThankYouPage`

        The php function

        function goToAnotherThankYouPage(&$fields){
        	global $modx;
        	//redirect to a different thank you page if new member.
        	if($fields['member'] == "no" ){
        		$modx->sendRedirect( $modx->makeUrl(155) );
        	}
        }



        do not forget to call the snippet containing the php function before the eForm call

        [!customFunctions!][!eForm? &formid=`yyy` .....

        Thx TobyL
          • 3316
          • 28 Posts
          THANK YOU!!

          This works great. I am using it to redirect a user to a document id based on their selection of a drop-down menu in the form. For example, when a user fills out the form, they should select how many thermostats their house has. Depending on their selection, it will take them to a page where they can see the price. The name of the field is "systems". Here’s the code I used (modified from above code):

          <?php
          function goToAnotherThankYouPage(&$fields){
          	global $modx;
          	//redirect to a different thank you page if new member.
          	if($fields['systems'] == "1" ){
          		$modx->sendRedirect( $modx->makeUrl(16) );
          	}
          	if($fields['systems'] == "2" ){
          		$modx->sendRedirect( $modx->makeUrl(11) );
          	}
          	if($fields['systems'] == "3" ){
          		$modx->sendRedirect( $modx->makeUrl(6) );
          	}
          	if($fields['systems'] == "4" ){
          		$modx->sendRedirect( $modx->makeUrl(5) );
          	}
          }
          ?>
            • 646
            • 5 Posts
            GREAT … thanks a lot. That saved me a lot of time!!!