top of page
Writer's pictureRobert Hebert

Block Specific Words from Your Wix Form Submissions



With the rollout of Wix's latest Editor, Wix Studio, Wix also rolled out a new version of their form system called Wix Forms (with the previous version still existing under the name Old Forms).


In this article, we will show you how to prevent certain words or phrases from being submitted through forms on a Wix website. This could be useful for various reasons, such as preventing spam, filtering out inappropriate language, or restricting specific terms that may not be relevant or allowed in the context of the form. By blocking specific words, website administrators can maintain the quality and relevance of the data collected, ensuring that submissions align with the intended purpose of the form.


Preventing spam submissions can usually be accomplished by adding a reCaptcha field but sometimes, spam submissions still get through, often times repeating the same content and flooding your email.


While there is not anything you can currently do to prevent the spam submissions, it is possible to prevent the submissions from reaching your inbox. This is done by editing the Wix Automation that is automatically created when you create a new Wix Form.





You can access this feature from the Dashboard by clicking the Automations menu item on the Side Menu. From here you should see an automation that says "New Submission received for" followed by the name of the form you're trying to affect. Click the three dots on the farthest right column and click Edit from the menu that appears.





From the edit screen, in between the Trigger and Action 1 Blocks, you should see "Add Condition". Click this and select the field you want to monitor for spam words from the dropdown under "Continue the automation if", and in the dropdown that appears to the right, select Text > doesn't contain, and then in the text field that appears to the right, enter the first word you would like to prevent from appearing in the submissions you receive emails for.


To add another word/phrase you want to filter by, click the "Add Criteria" button below the condition you just added, and above the Select criteria dropdown that appears make sure it says And instead of Or (if it says Or click that and change it to And from the dropdown). Here you can once again select the field you want to filter, select "doesn't contain" in the next dropdown, and then enter the word/phrase you want to prevent in the text field.


Repeat this as many times as needed and you can prevent these spam submissions from reaching your inbox!


Now if you're using Old Forms, you can pretty much copy and paste the provided code snippet into your page code, replace the "ID_OF_YOUR_OLD_FORM_ELEMENT" with the ID of your form and change the words in the PROHIBITED_WORDS variable to whatever words/phrases you are trying to filter as long as the words are surrounded by double quotes and separated by commas (i.e. ["word", "other word"])




This code checks every field for the values set up in the PROHIBITED_WORDS variable and if it finds any of them, it actually stops the form from being submitted!



Check out the code we used below:


const PROHIBITED_WORDS = ["spam", ".com", ".net", "profanity"];

const validate = (event) => event.fields.every(field => PROHIBITED_WORDS.every(word => field.fieldValue.includes(word) === false))

$w.onReady(function() {
	$w("#ID_OF_YOUR_OLD_FORM_ELEMENT").onWixFormSubmit(event => validate(event));
});



About our company


RHM specializes in helping businesses of all sizes and across all industries achieve their digital and web marketing needs. Whether you are designing a new website, building an app, performing custom development, or running Google Ads, our goal is to showcase how you are the best at what you do and help people connect with you. Contact us at 225-250-1888 to get started!

11 views0 comments

留言


bottom of page