The question is quite broad but I'll narrow it with my use case.
I don't use forms in my sites, just ajax calls to php services. Basically I use stylized spans with "click" events associated, which proceed to an ajax request posting everything to the server.
- No
<form>
element, - No
<input type="submit">
element. - If javascript is disabled, well... nothing works (whether or not it is a good thing is not the purpose of this post)
But I still want to be sure no smart$ss bot generates junk with my "forms".
So my question is: do I need a captcha or similar bot protection in this context?
Here is the solution I chose to implement, according to the given answer:
html:
<form id="honeypotform" action="http://whatever.com">
<input type="text" id="formbody">
<input type="submit" id="submitbtn" value="Submit">
</form>
css:
#honeypotform { display: none; }
The real submission link:
<span onclick="do();">Submit</span>
The link action:
function do() {
if (formbody.value != "") return true;
/* ... */
}
I'll follow up with this post to give feedback of my results after a few days.