validateInput( )


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() function of the Form 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() function or the 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: To work with the Wix Events API, you need to publish your site.

Method Declaration
Copy
function validateInput(
  inputName: string,
  formValues: Array<FormValue>,
): Promise<ValidationResult>;
Method Parameters
inputNamestringRequired

Name of the input field to validate.


formValuesArray<FormValue>Required

Field names and values for an RSVP form.

Returns
Return Type:Promise<ValidationResult>
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 });
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?