FormIt.Using a Blank NoSpam Field
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
$388 per month—let's make that $500!Learn more
Using a Blank No-Spam Field¶
Often, spambots fill every form field to pass validation. Thus, a good way to prevent spam is to add a field in your form and require it to be blank for submission to succeed.
FormIt provides you with the "blank" validator, which can be used to achieve a "nospam" field.
Simply add the following input into your form. You can change the name of the field at any time; using commonly used field names like "workemail" can be used to trick spambots into filling in the field:
<input type="hidden" name="workemail" value="" />
Then, in your FormIt call, add the blank validation:
If you wish to provide an error message to be displayed, you can do so in the normal FormIt syntax (this example would be
Make sure not to use an existing field name in your form for the nospam field! This will prevent FormIt from processing your form.