Help with Zip code validation

Trying to verify zip code against database for wix booking form
Wix editor
I am trying to limit customers to my service area. I am trying to modify wix booking form to error if zip code is not in my service area.
I have a zip code database setup but am stuck with the coding when i try to use the onReady command it keeps telling me the function does not exist on the page.

I have searched the community and only found 2 posting with no real answers.
I am very new to this would appreciate some help.

Are you able to share more details about your setup and what you’ve tried already?

It’s not possible to add additional code to the Bookings Form, but you can replace specific pages within the flow to add your own validation.

Here’s the article about creating a custom booking service page - Build a Custom Booking Service Page

I want to prevent clients from being able to go to booking page if they are not in my service area. Just need some code to validate there zip code is in the service area and if not in service area redirect them to Light box message indicating they are out of service area.

Did you ever get help on this? Having the same issue.

Hi, Writside !!

If you already have a clear list of postal codes, you can save it in a collection and simply query whether the entered postal code exists in the collection. If the accepted postal codes have clear patterns, you might first use a regular expression or .startsWith() to roughly determine if it is within the possible range. This can reduce the load of querying the collection, as you won’t query for obviously invalid codes.

Alternatively, if there is an API online that can return the address associated with the postal code, you could use that to create a simpler and more accurate validation module. Even in this case, it’s important to perform a rough validation first to avoid unnecessary API calls, especially if the API is paid and each call incurs a cost.

As for where this validation should take place, you could create a page before the reservation form where users enter their postal code. Based on the validation result, they can proceed to the main reservation form. This pre-validation page ensures only users with acceptable postal codes can proceed, reducing the risk of invalid entries. :wink: