We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2784
    • 2 Posts
    Hello everyone!

    I need to make an Ajax validation form (as I think, I’m new to such things). It looks like a lightbox appearing in front of the page, and it has several fields and captcha. I use SPForm for it, and on "no-js" fallback it works fine.

    If js is enabled, I check fields validation on client (actually, I use the SPFoem JS scripts for it), but I need to validate CAPTCHA as well. Can’t figure out how to do it. If I use jQuery plugin like jquery.form.js, it just gets the response from page containing SPForm snippet that everything is ok if I even don’t fill the CAPTCHA field.

    The idea is ti make a snippet to check just CAPTCHA and make form action redirect to the page containing this snippet and no template, but I don’t have enough experience to code it yet.

    Can you recomment me some tutorials on my issue (about writing captcha validation snippet etc) or provide another solution if I do something wrong?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Not sure about SPForm, but eForm all by itself on a resource with no template works great as an AJAX request processor. The first click on the "trigger" button or link loads the form, and submitting will return whatever eForm normally returns. It’s just a matter of having your AJAX request use the URL to the resource, and displaying what gets returned.
        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
        • 2784
        • 2 Posts
        Quote from: sottwell at Aug 16, 2011, 10:46 PM

        Not sure about SPForm, but eForm all by itself on a resource with no template works great as an AJAX request processor. The first click on the "trigger" button or link loads the form, and submitting will return whatever eForm normally returns. It’s just a matter of having your AJAX request use the URL to the resource, and displaying what gets returned.

        Well, I use last version of Revo, so, I think, eForm doesn’t work with it. Am I right?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          That was just by way of example, since it’s what I have actually done. I’m sure that SPForm will do the same, whether in Evo or Revo.
            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
            • 3749
            • 24,544 Posts
            The Captcha add-on sets a $_SESSION variable with the correct answer before it serves up the image ($_SESSION[’veriword’]). Your JS code would have to check that against the user’s input.

            You are correct that eForm doesn’t work in Revolution. FormIt is the replacement, though modifying SPForm to do it would also be an option.

            If you get it to work in SPForm, please post your code here. If I have time, I might add it to the package.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting