Quote from: Soshite at Jun 25, 2007, 06:58 PM
I would use CAPTCHA here, but it doesn’t want to work on my server...
Is there any way to have a field in EForm like, "2+3=?", and make it so the value MUST be 5 to submit the form? EForm is going to be used to create Web User accounts (via EFreg), and I’ve noticed some spam accounts lately.
So something like this would help out a lot, since the spam bots likely couldn’t solve that problem correctly.
"Where there’s a Will, there’s a way" ...and if it’s in MODx, then there’s generally a Shortcut!
Let’s see...you could create a custom MySQL table containing a series of algebraic equations like above in one column, and the correct answer in another. Give the table an auto_increment `id` column, too.
Randomly select 1 row (ID) and store it in a PHP Session. You’ll need to display the associated equation for that ID, so you’ll have to use eFormOnBeforeFormMerge to properly build your form.
Set up the answer as a non-required field (so eForm doesn’t steal control) then use eForm’s function/event handlers (probably eFormOnBeforeMailSent ?) to further control/validate your form submission.
You’ll want to query the table based on the row ID in Session to retrieve the correct answer, which you can then compare to the answer from the form submission.
If they match,
and you should be set. If not,
and override the existing equation ID in Session with a different ID and repeat!