> 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

> **Deprecated.** This method is deprecated. Planned removal date: 2025-01-01.

# Method name: validateInput(inputName: string, formValues: Array<FormValue>)

# Method package: wixEventsFrontend

# Method menu location: wixEventsFrontend --> RsvpForm --> validateInput

# Method Link: https://dev.wix.com/docs/velo/apis/wix-events-frontend/rsvp-form/validate-input.md

# Method Description:

**Deprecated:** Validates an input form field value against the registration form as defined in the site Dashboard.

**Deprecation note:** The `validateInput()` function of the `RsvpForm` object is being deprecated.
 Use the [`validateInput()`](https://dev.wix.com/docs/velo/apis/wix-events-frontend/form/validate-input.md) function of the [`Form`](https://dev.wix.com/docs/velo/apis/wix-events-frontend/form/introduction.md)
 object instead.

 The `validateInput()` function returns a Promise that resolves to `{valid: true}`
 if the value in the specified field is valid or rejects if it is not valid.

 You can validate your form's values explicitly using the `validateInput()` function.
 Value validation is also implicitly performed when you call the [`submit()`](#submit) 
 function or the [`validate()`](#validate) function.

 You may want to call the `validateInput()` function in an input element's
 `onCustomValidation()` event
 handler to validate an input while the form is being filled out.

 > **Note:** The frontend Events APIs aren't functional when previewing a site. View a published version of a site to see their complete functionality.



# Method Code Examples:

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

## Validate an RSVP form value

```javascript
import wixEventsFrontend from 'wix-events-frontend';

// ...

const eventId = // Get the event ID
const form = wixEventsFrontend.createEventRsvpForm(eventId);

// ...

let formValues = // get form values

form.validateInput("firstName", formValues)
  .then((response) => {
    // handle case where firstName is valid
  })
  .catch((error) => {
    // handle case where firstName is not valid
    let message = error.message; // "First Name is required"
    let type = error.errorType; // "EMPTY_INPUT"
    let inputId = error.inputId; // firstName
  });
```

## Validate a form value in an element's `onCustomValidation()` handler

```javascript
import wixEventsFrontend from 'wix-events-frontend';

// ...

const eventId = // Get the event ID
const form = wixEventsFrontend.createEventRsvpForm(eventId);

// ...

$w("#firstName").onCustomValidation((value, reject) => {
  form.validateInput("firstName", getFormValues())
    .catch((error) => {
      let message = error.message; // "First Name is required"
      let type = error.errorType; // "EMPTY_INPUT"
      let inputId = error.inputId; // firstName
    });
});
```

## Create and submit an RSVP form

```javascript
import wixEventsFrontend from 'wix-events-frontend';
import wixData from 'wix-data';

$w.onReady(function () {
  let form;

  // Run a query that returns only one event. Add
  // additional filtering to the query if necessary.
  wixData.query("Events/Events")
    .eq("title", "My Event")
    .find()
    .then((results) => {
      if (results.items.length > 0) {
        form = wixEventsFrontend.createEventRsvpForm(results.items[0]._id);
      } else {
        console.log("Could not find event");
      }
    });
  
  $w("#submit").onClick(() => {
    const formValues = getFormValues();

    form.submit(formValues)
      .then((result) => {
        console.log("RSVP form submitted.")
      })
      .catch((error) => {
        console.log(`Error message: ${error.message}`);
        if (error.fields) {
          console.log(`Incorrect fields: ${error.fields}`);	
        }
      });	
  });
});

function getFormValues() {
  return [
    {"name": "rsvpStatus", "value": "YES"},
    {"name": "firstName", "value": $w("#firstName").value},
    {"name": "lastName", "value": $w("#lastName").value},
    {"name": "email", "value": $w("#email").value},
    {"name": "custom", "value": $w("#foodAllergies").value},

    // When a form contains an address, the way you format the
    // address information for submission depends on what type
    // of input elements you use to gather that information.

    // Wix address input element.
    {"name": "address", "value": $w("#address").value},

    // Single element which is not an address
    // input element, such as a text input.
    {"name": "address", "value": [$w("#address").value]},

    // Multiple elements for the
    // various parts of an address.
    {
      "name": "address", 
      "value": [
        $w("#street").value,
        $w("#city").value,
        $w("#state").value,
        $w("#country").value,
        $w("#postalCode").value
      ]
    },

    // When a form contains an input for adding more guests to an
    // RSVP, format the guest names for submission in an array
    // where each element is the full name of a guest.
    {"name": "additionalGuests", "value": $w('#additionalGuests').value},
    {
      "name": "guestNames",
      "value": [
        `${$w("#guest1FirstName").value} ${$w("#guest1LastName").value}`,
        `${$w("#guest2FirstName").value} ${$w("#guest2LastName").value}`,
      ]
    }
  ];
}
```

---