Form Spam Bot Control
This procedure adds a text field to your form that will be hidden in most web browsers using CSS. When this field is filled in by a spambot, the form contents will be discarded and nothing will be sent to the form's e-mail recipient. This is an effective way to curb the amount of spam you receive from the forms on your Web site. The remarks field created in the last section will be hidden on the form, although authors will still be able to edit this field by logging into the Web site, navigating to the appropriate form, and clicking on the contents tab.
Add the class definition to the style sheet
This section only needs to be completed once on your Web site. If you have already added the class definition to your PloneCustom.css file, go to the "Add the remarks field to the form" section below.
- Login as admin
- Click on the Site Setup link
- Click on the Zope Management Interface link
- Click on the portal_skins (Controls skin behavior (search order etc)) link
- Click on the Custom link
- Click on the ploneCustom.css link
- Scroll about a third of the way down the text area and place the cursor just above /* </dtml-with> */
- Type, or copy and paste, the following text:
/* this is the spam prevention field */ div#archetypes-fieldname-remarks { display: none; } - Click on the Save Changes button
- Click on the first / in the path at the top of the page
- Click on
CacheSetup_ResourceRegistryCache (Cache for saved ResourceRegistry files) link
- Click on the Statistics tab at the top of the page
- Click on /cityname/portal_css where cityname is your city name as it appears in your domain name
Note: There may not be a cached CSS file for your Web site. If this is the case, you will not see the /cityname/portal_css entry for your city, and you may skip ahead to step 15 in this section. You may also see portal_css cache files for other PLOW Web sites. - Click on the Invalidate button
- Click on the first / in the path at the top of the page
- Click on the View tab at the top of the page
- Log out of the admin account
Add the remarks field to the form
This section should be completed for every form you want protect from spam bots. For this to be most effective, the remarks field should be the last field on the form.
- Log in as an author
- Create a new form or edit an existing form (see How to Add a Form to the Web Site)
- In the form folder click Add Item
- Select Text Field
- Add this metadata:
- Shortname: remarks
- Title: Enter Your Remarks Here
- Field Help: Please leave the following field blank
- Scroll to the bottom of the page and click on the Next button.
-
Replace the contents of the Custom Validator with this script:
python: test(len(value)<=0, False, 'Input should not be filled in!')
- Click on the Save button
