Forum

Thread tagged as: Question, Forms

Using Akismet on contact form

I'm trying to combat some major spam on a client's contact form, and have convinced them to use the Akismet service.

<perch:label for="name">Name <span class="req">*</span></perch:label>
<perch:input id="name" type="text" required="true" label="Name" antispam="name" placeholder="Your name" />

<perch:label for="email_add">Email <span class="req">*</span></perch:label>
<perch:input id="email_add" type="email" required="true" label="Email address" antispam="email" placeholder="ex: email@example.com" />

<perch:label for="phone_num">Phone</perch:label>
<perch:input id="phone_num" type="text" label="Phone #" placeholder="ex: 250-555-5555" />

<perch:label for="address">Address</perch:label>
<perch:input id="address" type="text" label="Address" placeholder="ex: 1234 Main St." />

<perch:label for="city">City</perch:label>
<perch:input id="city" type="text" label="City" placeholder="ex: Nanaimo, BC" />

<perch:label for="message">Message <span class="req">*</span></perch:label>
<perch:input type="textarea" id="message" required="true" antispam="body" label="Details" placeholder="How can we help?" />

The name, email, and message fields all have a corresponding antispam="xyz" parameter – name, email, and body respectively. What about the phone number, address (street), and city fields? Should these have any antispam markup on them?

The phone number field and city field are typically filled in (by spam bots) with "proper" data – i.e., 9-10 numerals for the phone, and a real city name. The address field, however, often gets a scummy URL (again we're asking users for a street address, not a URL).

I'm worried if I use antispam="url" on this field it will not work as intended. Any thoughts here?

Note that the form has just been updated, so it's possible all will work fine without any more code. Just wondering if anyone else has had a similar experience.

Thanks as always!

Richard Terrick

Richard Terrick 3 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Akismet is designed primarily for comments, so only has options for the typical fields you have on comment forms. If something isn't a URL, don't label it as a URL. Only use the options that match your expected content.

Thanks for the clarification, Drew. So far it's caught all the spam as I'd hoped and put it in the Spam tab of the Form Responses.

I assume that those don't get emailed even when "Send response via email" is set?

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's right.