Step 1: create a "honeypot" field
- Create a new text field in your form (not a hidden field, we'll hide it with JS later).
- Set up your form processing steps to run conditionally only if the value of this field is "blue" or whatever the correct answer is. That way submissions with the wrong answer will not be added to the database.
- You might want to add a form processing step to send you a notification email if the form is filled out with the wrong answer so that you can monitor the spam submissions and make sure it's working well. You can always turn that off later.
- If you're using the default Eloqua 10 form layout, the easiest way to do this is to hide the div with id "formElementX" where X is the number of the order that the field appears on the form, starting from 0.
- I settled on using the "focus" event on all form elements because even if the user is using their browser to auto-fill the fields, they will still have to place focus on some form element in order to submit the form.
- If you use some other event, make sure that it's an event that any human user must trigger in order to submit the form, but not one that is automatically triggered when the page loads (such as window load) because some bots may be smart enough to execute it.
This example uses jQuery, so you'll need to make sure you're loading the jQuery library on the page. If you're using an externally hosted landing page and you're already using a different version of jQuery, remove the first line in the code. You can replace the first line with whatever version of jQuery you prefer to use. This code also assumes you are using the default Eloqua 10 form code, but it could easily be adapted to whatever form layout you're using.
Insert this code into the <head> section of your document if you're using an external form, or into the JS field in the Tools bar if you're using an Eloqua 10 landing page.
Be sure to replace "formElement7" with the id of your honeypot field's parent div (remember the fields are labeled starting from 0). Replace "sky" with the HTML name of your honeypot field, and "blue" with the correct answer to your obvious question.
So far this is working well for me - I'll post updates if I find that there are problems or if I want to recommend modifications to the technique.