We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15415
    • 2 Posts
    Hi,
    am using modx eform version 1.4.4.6 and also am using all latest version of snippets and modules for my project.In my site,am using two forms with two captcha in single page.Now form is not submitting,after am submitting the form it shows "invalid verification code".I dont know,what are all the steps to fix that issue.Please anyone help me?........................
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The problem is that the eForm captcha loads the value of the generated captcha image into the SESSION array; it is then compared with what the user enters on submission. With two captchas, the last one to be generated will load its value into the SESSION, overwriting the first one’s value.

      My suggestion would be to explore other methods of form-spam prevention. I use a bogus form field that must be left empty, with CSS to move it off the screen. Form spam bots will fill out all fields, so the form submission fails. I use a snippet to check the field that returns false to silently abort eForm processing if it’s not empty.



        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 16702 ☆ A M B ☆
        • 536 Posts
        I never used it, but maybe the solution is:

        SPForm
          palma non sine pulvere
          • 15415
          • 2 Posts
          lot of thanks for replies...shall i set some form id where i set that $_SESSION[’veriword’] in eform.inc.php.whether that form id may differentiate that two forms or not?...So now i can submit form? and there is any possibility to set that form id like?.....
            • 32046
            • 75 Posts
            I know this is old but I also had this issue today and needed a workaround. I have two eforms on my page but this should work with unlimited number. For anyone else looking for a solution to this I did the following:

            Look for line 570-ish on eform.inc.php; (I know "hacking the core code is bad etc etc...") I’m not sure of exact line number as my eform code is hacked many times over wink
            It should currently read:
            $fields['verimageurl'] = $modx->config['base_url'].'manager/includes/veriword.php?rand='.rand();


            This line generates the captcha code using a random number passed to the veriword script. It is different every time eform is called, so is different for both eforms on your page. Replace it with:
            $fields['verimageurl'] = $modx->config['base_url'].'manager/includes/veriword.php?rand=' . $_SERVER["REQUEST_TIME"];


            This simply uses the timestamp from when the index.php page was requested (updated every second) as the "random number" and so both eforms will now use the same captcha "random number" and so have the same captcha value, so your forms will not be confused as to which captcha code to verify. Probably not an incredibly secure solution but hey, captcha is only really meant for spam prevention so it doesn’t really matter too much.

            This is not thoroughly tested but should (and appears to) work.
              • 16702 ☆ A M B ☆
              • 536 Posts
              interesting idea smiley i thing is work...
                palma non sine pulvere
                • 14214
                • 299 Posts
                I had a similar issue at one point, and for lack of a better solution, I ran one inside of an iframe which solved it.