Introduction

The Form Submission service plugin (formerly SPI) allows site owners and collaborators to validate a site visitor's filled form. For example, you can validate whether a correct email is entered into the field. Site owners and collaborators can either write their own custom validation logic, or integrate with a 3rd-party validations provider.

Wix Forms calls validateSubmission() to validate a site visitor's filled form. The custom validation plugin code validates the request, and returns any validation violation data in a site visitor's form (using the structure provided by Wix Forms). If there aren't any validation violations, the function should return an object containing an empty array. Site visitors can see validation violations in their forms.

Before you begin

  • There are several apps that use forms. To validate form submission for a specific Wix app, configure the service plugin's config file for that Wix app by defining the relevant namespace field. For example, the namespace for the Wix Forms app is wix.form_app.form.

To add a service plugin

  1. Add the service plugin to your site.
  2. Update the getConfig() function in the -config.js file that is added to your site during step 1.
  3. Update the validateSubmission() function in the .js file that is added to your site during step 1.

Use Cases

With the Validations service plugin you can define the validations for a site form that fit your site's needs. Possible validations include:

  • Field validations: Check if the name contains only alphabetic characters.
  • Prevent duplicate submissions: Check for duplicate submissions based on certain criteria and prevent site visitors from submitting the same form multiple times.
  • Verify fields: Call a local post API call to check if the entered postal code is local.

Terminology

TermDefinition
SubmissionData received when a site visitor submits a form.
ValidationProcess that makes sure the information that the site visitor put into a form is correct and meets certain rules.
TargetOnline interface that allows site visitors to input and submit data.
Was this helpful?
Yes
No