Populate phone number country code

Home Forums Quform WordPress Populate phone number country code

This topic is: not resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #34423
    MOVOX
    Participant

    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

    #34432
    Allan
    Support Staff

    You 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.
    #34436
    MOVOX
    Participant

    Hi 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.
    #34439
    Allan
    Support Staff

    You 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.
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy