Wix Forms - how to validate a 9-digit number
I had a Wix Forms Question for a client, we wanted to validate that a form field has 9 numeral digits (for an account number) before submitting. She also had another field that she wanted just 5 digits allowed.
I tried some pattern validation codes (like "^\d{9}$ " and the one shown above), but none of them worked. I scheduled a call and talked with Wix Phone Support and they said it wasn't possible. But they were wrong, it is possible!
I figured out a hack workaround. You can choose Phone Number from the Type under your Text Input Settings for the field, and then choose Select Number Format and choose Custom, then put in the format desired. In this case my client wanted it in this format: ###-##-####, but you could do ####-#### or #-###### or whatever you want! Just because you choose Phone Number for the type, that doesn't mean it has to be a standard phone number format, and, you can name it anything you want in the field name/title for the backend submissions. This works perfectly. You can do this with any number, too, if you want to make sure it's a certain number of digits.
Happy Wixing!
Comments