• SPForm Ajax validation#

  • bardt Reply #1, 9 months, 1 week ago

    Reply
    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?


  • sottwell Reply #2, 9 months, 1 week ago

    Reply
    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.


  • bardt Reply #3, 9 months, 1 week ago

    Reply
    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?


  • sottwell Reply #4, 9 months, 1 week ago

    Reply
    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.


  • BobRay Reply #5, 9 months, 1 week ago

    Reply
    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.