> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: onWixFormSubmitted(eventHandler: WixFormSubmittedEventHandler)

# Method package: w

# Method menu location: w --> WixForms --> onWixFormSubmitted

# Method Link: https://dev.wix.com/docs/velo/velo-only-apis/$w/wix-forms/on-wix-form-submitted.md

# Method Description:

Adds an event handler that runs when a site visitor submits a Wix Form and it is successfully received by the server.

When the site visitor submits a Wix Form, the field values are cleared and the `onWixFormSubmitted()`
 callback runs for the [`WixForms`](https://dev.wix.com/docs/velo/api-reference/$w/wix-forms/introduction.md) element. 

 The callback to run when the Wix Form is submitted is either the name of the function
 or a function expression.

 The received `WixFormSubmittedEvent` object 
 contains information about the Wix Form that was submitted. The `WixFormSubmittedEvent` object is returned by the 
 callback asynchronously following verification of a successful submission, while the server starts to process the
 relevant actions.


 `onWixFormSubmitted()` provides information and functionality available on the client side:

 + The function has access to the field names and field values on the form but does not have access to submission details that exist only on the server, such as the contact ID and the submission time.
 + The function performs operations only on the client side, such as displaying a message after submission. 


 For other Wix Forms events, see: 

 + The [`onWixFormSubmit()`](#onWixFormSubmit) event handler, which sets events that fire when a site visitor submits a Wix Form yet before it is sent to the server. 
 + The [`onWixFormSubmittedError()`](#onWixFormSubmittedError) event handler, which sets events that fire when a site visitor submits a Wix Form and it is *not* received by the server. 
 + The [`onFormSubmit()`](https://dev.wix.com/docs/velo/apis/wix-crm-backend/events/on-form-submit.md) event handler, which is called in the Backend section's code, to set events that fire on the backend when a site visitor submits a form.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## An event is fired on a WixForms element when the Wix Form is submitted

```javascript
$w("#myWixForm").onWixFormSubmitted( ( {fields} ) => {
  let firstName = fields[0].fieldValue;
  let lastName = fields[1].fieldValue;
  let donation = fields[2].fieldValue;
  let email = fields[3].fieldValue;
  $w('#myText').text = `Thank you, ${firstName} ${lastName}, for your generous donation of ${donation}.`;
});

/* fields array of objects: 
 * [
 *    { 
 *      "id" : "inputFirstName",
 *      "fieldValue" : "Maria",
 *      "fieldName" : "Enter first name"
 *    },
 *    { 
 *      "id" : "inputLastName",
 *      "fieldValue" : "Santora",
 *      "fieldName" : "Enter last name"
 *    },
 *    { 
 *      "id" : "inputDonation",
 *      "fieldValue" : "1000",
 *      "fieldName" : "Enter donation amount"
 *    },
 *    { 
 *      "id" : "inputEmail",
 *      "fieldValue" : "ms@theCompany",
 *      "fieldName" : "Enter email"
 *    }
 * ] 
 */
```

---