Title: Checking form before submission
Last modified: September 2, 2018

---

# Checking form before submission

 *  [funsail](https://wordpress.org/support/users/funsail/)
 * (@funsail)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/checking-form-before-submission/)
 * I get form spam where the first and last name are exactly the same. Is it possible
   to add JavaScript to check this and not submit the form in this case?
    -  This topic was modified 7 years, 8 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [7 years, 8 months ago](https://wordpress.org/support/topic/checking-form-before-submission/#post-10649033)
 * Have you tried adding a recaptcha?
 * What form plugin are you using?
 *  Thread Starter [funsail](https://wordpress.org/support/users/funsail/)
 * (@funsail)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/checking-form-before-submission/#post-10649051)
 * I don’t want to use recaptcha, since I don’t get a huge amounts of spam. It’s
   just this robot spam that’s so specific I thought can add this to the site with
   some simple script that doesn’t affect real users.
 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [7 years, 8 months ago](https://wordpress.org/support/topic/checking-form-before-submission/#post-10649057)
 * Again, what plugin are you using for your form? There are anti-spam plugins that
   work with some of the forms plugins.
 *  Thread Starter [funsail](https://wordpress.org/support/users/funsail/)
 * (@funsail)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/checking-form-before-submission/#post-10649064)
 * I’m trying to move away from cf7 hence wanting something more generic. I know
   they run JavaScript because they pass cloudflare js challenge. That’s why I want
   to know how to do an exact check with the first name and last name are identical.
 *  Thread Starter [funsail](https://wordpress.org/support/users/funsail/)
 * (@funsail)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/checking-form-before-submission/#post-10649070)
 * It’s probably a new spam software. I get different spams from the same setup.
   I already have the honey pot plugin.
    Today it’s about bitcoin and a sick person.
   Last time it’s something else.
 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [7 years, 8 months ago](https://wordpress.org/support/topic/checking-form-before-submission/#post-10649072)
 * Before it’s submitted, it would have to be in Javascript, something like [https://stackoverflow.com/questions/12058081/comparing-two-input-fields](https://stackoverflow.com/questions/12058081/comparing-two-input-fields)
 * Afterwards, you’d do it in whatever PHP processes the form.
 * There is no “generic” solution. It depends on how you build your form.
 *  Thread Starter [funsail](https://wordpress.org/support/users/funsail/)
 * (@funsail)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/checking-form-before-submission/#post-10649217)
 * Hmm, since I use a plugin I can’t edit the code it generates to add this
 * <form onsubmit=”return Validate(this);”>
 * I see it generates a novalidate too
 * <form action=”/contact/#wpcf71″ method=”post” class=”wpcf7-form” novalidate=”
   novalidate”>
 * Does that mean I can’t inject validation code from the page?
 * I want to move away from cf7, would you have any rec’d?
 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [7 years, 8 months ago](https://wordpress.org/support/topic/checking-form-before-submission/#post-10653271)
 * I’m not sure you know but there is at least one plugin that can check validation
   available for CF7: [https://wordpress.org/plugins/cf7-field-validation/](https://wordpress.org/plugins/cf7-field-validation/)
 * Then again, I’m not entirely sure how you feel about adding another plugin to
   the mix, just thought I would mention that. 🙂

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Checking form before submission’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 3 participants
 * Last reply from: [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/checking-form-before-submission/#post-10653271)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
