We are using 4 fields for phone number entry. We are supposed to support international phone numbers. Country_code1, Area_code1, Main_Phone, Extension1
We default and hide the country code field when the selected country is US. We also have an area code field, a phone number field and an extension field.
We remove any '-' from the phone number field before it is sent to our server so the phone number is formatted like this when it gets to our server:
cc-ac-number-ext , i.e. 1-800-9059912- (blank extension)
Should look like this in our DB:
Country_code1, Area_code1, Main_Phone, Extension1 1 800 9059912
Now, the issue is that a LOT of people are entering the first three digits of their US phone number in the phone number field and apparently tabbing into the extension field and entering the last 4 of their phone number there.
This cause the phone number to be entered into our DB like this:
Country_code1, Area_code1, Main_Phone, Extension1 1 800 905 9912
How would I fix the validation of these in order to also support international phone numbers?
Screenshot of layouts:
This is how we do it on another one of our sites:
SO I guess reorganizing the outputs may help somewhat. But client-side validation is still going to be problematic. We currently only test to make sure the number field is populated.
Here is the new planned layout vs. the current layout: