Home › Forums › Quform WordPress › Populate phone number country code
- This topic has 3 replies, 2 voices, and was last updated 2 years, 4 months ago by Allan.
- AuthorPosts
- June 26, 2022 at 12:30 pm #34423MOVOXParticipant
I have a drop down field with listing the names of various countries, another drop down field listing cities and locations based upon the selected country, and a text field for entry of a phone number.
I’m trying to find a solution to pre-populate the phone number field with the phone country code, followed by a space, and following this only allow for entry of the available area code combinations (which vary in length) that are possible for the selected country.
I’ve tried some of the suggested solutions in your forums and also tried to implement the code at https://intl-tel-input.com (which would be ideal) but cannot get this to work.
The following is what I am trying to achieve:
– If the selected country was the USA, then the phone number field would pre-populate +1 as the country code followed by a space and then allow for the possible area codes, e.g. the US State of Arizona has the area codes are: 928, 480, 602, 520, and 623;
– If the selected country was the UK, then the phone number field would pre-populate +44 as the country code followed by a space and then allow for the possible area codes, e.g. city of Edinburgh the code is 131 and calling Bristol could be either 117 or 1275;
– The selected countries values would pre-populate the phone number field. When the field is selected to enter the phone number the cursor would commence after the pre-populated country and area code values and 1 x white space, e.g. +44 1275 |XXX XXX
July 1, 2022 at 12:20 am #34432AllanSupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
Attachments:
You must be logged in to view attached files.July 1, 2022 at 1:11 am #34436MOVOXParticipantHi Allan,
That’s almost perfect. The only adjustments required is that the country code is pre-populated in the phone number field prior to the area code. And, that the country code is not a place holder that can be typed over. When the cursor enters the number field it would begin after the country code and a space.
Please see the attached image as an example.
Attachments:
You must be logged in to view attached files.July 2, 2022 at 1:42 am #34439AllanSupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
Attachments:
You must be logged in to view attached files. - AuthorPosts
- You must be logged in to reply to this topic.