> 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 resource is deprecated.

# Method name: formData()

# Method package: wixEventsFrontend

# Method menu location: wixEventsFrontend --> Form --> formData

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

# Method Description:

**Deprecated.**
This object will be deprecated on March 30, 2026. Replace with the object from [getForm()](https://dev.wix.com/docs/sdk/backend-modules/events/forms/get-form.md).

> **Migration Instructions**
>
> To stay compatible with future changes, migrate to
> [`getForm()`](https://dev.wix.com/docs/sdk/backend-modules/events/forms/get-form.md).
>
> To migrate to the new method:
>
> 1. Add a backend file to your site.
>
> 2. Write a code so that it replaces the `formData` object from the frontend with the `getForm()` method's object from the backend. Export your backend function so that it can be used in the frontend.
>
> 3. Import your backend function into the frontend file. Test your changes to make sure your code behaves as expected.

 The returned `FormData` object contains the information you need to create
 a custom registration form for the specified event.

 This information includes:

 + The event's registration status, such as whether registration is
   open, closed, or guests will be placed on a waitl ist.
 + Which statuses guests can RSVP with, such as yes, no, or to be added
   to the wait list.
 + Whether the event is a ticketed event.
 + Information about the registration form's fields, such as their names, 
   descriptive labels, and whether they're required.

 > **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.

## Get a registration form's information

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

// ...

const eventId = // Get the event ID

wixEventsFrontend.getForm(eventId)
  .then((form) => {
    let formData = form.formData;

    let fields = formData.formInputs;
    let firstFieldName = fields[0].name;
    let statusOptions = formData.rsvpStatusOptions;
    let registrationStatus = formData.registrationStatus;
    let isTicketed = formData.isTicketed;
  });

/*  formData:
 *
 *  {
 *    "rsvpStatusOptions": "YES_AND_NO,
 *    "registrationStatus": "OPEN_RSVP",
 *    "isTicketed": false,
 *    "formInputs": [
 *      {
 *        "_id": "37a5789b-27d1-43a3-703b-a93dedad5b01",
 *        "additionalLabels": [],
 *        "array": false,
 *        "controlType": "NAME",
 *        "label": "First Name",
 *        "required": true,
 *        "maxLength": 50,
 *        "name": "firstName",
 *        "options": []
 *      },
 *  
 *      ...
 *  
 *      {
 *        "_id": "27d5789b-137a-43ed-a33d-a9703bad5b01",
 *        "additionalLabels": [
 *          {
 *            "name": "one",
 *            "label": "I'm bringing a plus one"
 *          },
 *          {
 *            "name": "multiple",
 *            "label": "Additional Guests"
 *          }
 *        ],
 *        "array": false,
 *        "controlType": "GUEST_CONTROL",
 *        "label": "I'm bringing a plus one",
 *        "required": true,
 *        "maxLength": 0,
 *        "name": "additionalGuests",
 *        "options": [
 *          "0",
 *          "1"
 *        ]
 *      }
 *    ]
 *  }
 */
```

## Create and submit a registration form

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

$w.onReady(function () {
  let eventId;
  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) {
        eventId = results.items[0]._id;
        wixEventsFrontend.getForm(eventId)
          .then((result) => {
            form = result;
          });
      } else {
        console.log("Could not find event");
      }
    });

  $w('#submit').onClick(() => {
    let 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() {
  const formValues = [{"name": "rsvpStatus", "value": "YES"}];
    
  form.formData.formInputs.forEach((item) => {
    formValues.push(
      {
        "name": [item.name],
        "value": $w(`#${item.name}`).value
      }
    );
  });

  // When the form contains an address or additional
  // guests, add code to add those values to formValues.

  return formValues;
}
```

## Reserve, checkout, and update tickets

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

let eventId;
let form;
let reservationId;
let orderNumber;
let tickets;

$w.onReady(function () {
  // Retrieve data and set up page
  await getData();
  $w("#ticketRepeater").onItemReady(displayTickets);
  $w("#ticketRepeater").data = tickets;

  // Define button click actions
  $w("reservationButton").onClick(reserveTickets);
  $w("checkoutButton").onClick(checkoutTickets);
  $w("updateButton").onClick(updateTickets);

  // Verify coupon code when it is entered
  $w("#couponCode").onCustomValidation(verifyCouponCode);
});

async function getData() {
  // Run a query that returns only one event. Add
  // additional filtering to the query if necessary.
  const eventResults = await wixData.query("Events/Events")
    .eq("title", "My Event")
    .find();

  if (eventResults.items.length > 0) {
    eventId = eventResults.items[0]._id;

    // Get the event registration form
    form = await wixEventsFrontend.getForm(eventId);

    // Get tickets for the event
    const ticketResults = await wixData.query("Events/Tickets")
      .eq("event", eventId)
      .find();

      if (ticketResults.items.length > 0) {
        tickets = ticketResults.items;
      } else {
        $w("#ticketRepeater").hide();
        console.log("Could not find tickets");
      }
  } else {
    console.log("Could not find event");
  }
}

function displayTickets($item, itemData, index) {
  $item("#ticketName").text = itemData.name;
  $item("#ticketPrice").text = itemData.price.toString();
  $item("#ticketQuantity").value = 0;
}

function reserveTickets() {
  const selectedTickets = getSelectedTickets();

  wixEventsFrontend.tickets.reserve(eventId, selectedTickets)
    .then((reservation) => {
      reservationId = reservation.id;
    })
    .catch((error) => {
      console.log("Error", error.message)
    });
}

function getSelectedTickets() {
  let selectedTickets = [];

  $w("#ticketRepeater").forEachItem(($item, itemData, index) => {
    if ($item("#ticketQuantity").value > 0) {
      selectedTickets.push( {
        "ticketId": itemData._id,
        "quantity": $item("#ticketQuantity").value
      });
    }
  });

  return selectedTickets;
}

function checkoutTickets() {
  wixEventsFrontend.tickets.checkout(eventId, reservationId, {
    "formValues": getFormValues(),
    "coupon": $w("#couponCode").value
  })
    .then(({order}) => {
      orderNumber = order.orderNumber
      wixPayFrontend.startPayment(order.paymentId);
      // Note that PDF tickets are available before payment is complete
      $w("ticketsPdfLink").value = order.ticketsPdf;
    })
    .catch((error) => {
      console.log("Error", error.message)
    });
}

function updateTickets() {
  wixEventsFrontend.tickets.updateOrder(eventId, orderNumber, {
    "formValues": getFormValues()
  })
    .catch((error) => {
      console.log("Error", error.message)
    });
}

function verifyCouponCode(value, reject) {
  const coupon = $w("#couponCode").value;
  wixEventsFrontend.tickets.verifyCoupon(eventId, reservationId, coupon) 
    .then((result) => {
      if (result.discountErrors) {
        // handle verification failure
        $w("#couponCode").updateValidityIndication();
        $w("#couponErrorMsg").show();
        $w("#couponSuccessMsg").hide();
        reject("Coupon is invalid");
      } else {
        // handle coupon verified
        $w("#couponErrorMsg").hide()
        $w("#couponSuccessMsg").show()
      }
    });
}

function getFormValues() {
  const formValues = [];
    
  form.formData.formInputs.forEach((item) => {
    formValues.push(
      {
        "name": [item.name],
        "value": $w(`#${item.name}`).value
      }
    );
  });

  // When the form contains an address or additional
  // guests, add code to add those values to formValues.

  return formValues;
}

```

---