We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3350
    • 8 Posts
    Hi I am using ModX v. 0.9.6.1 and the eForm snippet v.1.4.4 . I have a simple contact form that receives some parameters that help determine who should be emailed. I pass these parameters to the form via the $_GET array and I use the eFormOnBeforeFormParse to call a function that will set the values passed in as fields made available to the form. In my form these fields are set as hidden input values.

    When the form is finally loaded to the browser everything is fine, the values have been set and my form is made available to the user. However, when the form is submitted, the values I set in the hidden fields do not pass validation. I get a message:

    ministry_id » Tampering attempt detected!
    ministry » Tampering attempt detected!

    I realize it is because my function call to eFormOnBeforeFormParse is setting these values programatically, but how can I either disable to the tampering detection with eForm or get eForm to recognize that the two fields that have been set are valid?

    This is my snippet call:
    [[eFormEvent]] [!eForm? &formid=`feedbackForm` &to=`somecomma delimited email address` &tpl=`eMinistryForm` &report=`eMinistryReport` &thankyou=`eMinistryThanks`&automessage=`eMinistryAutoMessage` &autosender=`no-reply@email address` &mailselector=`ministry_id` &eFormOnBeforeFormParse=`setMinistryFormProfile`  !]


    This is my code that sets the fields that are passed in as hidden values and called by eFormOnBeforeFormParse
    <?php
    function setMinistryFormProfile(&$fields, &$templates) {
        if (empty($_POST)) {
            (array_key_exists('ministry', $_GET)) ? $_GET['ministry'] : $_GET['ministry'] = 'Membership';
            (array_key_exists('ministry_id', $_GET)) ? $_GET['ministry_id'] : $_GET['ministry_id'] = 2;
            $fields['ministry_id'] = $_GET['ministry_id'] ;
            $fields['ministry'] =  $_GET['ministry'] ;
        }
       else  {
            $fields['ministry_id'] = $_POST['ministry_id'] ;
            $fields['ministry'] =  $_POST['ministry'] ;       
      }
        return true;
    }
    ?>