• Resolved rajinderkaur

    (@rajinderkaur)


    how to show country code with selected country flag or to be more precise just to show country code of selected country

    • This topic was modified 4 years, 7 months ago by rajinderkaur.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Yordan Soares

    (@yordansoares)

    Hello @rajinderkaur,

    There are several email tags you can use to show specific parts of the internationala telephone field:

    • [{your-phone}-cf7it-country-name]: Shows the name of the country. For the example above: Venezuela
    • [{your-phone}-cf7it-country-code]: Shows the country code of the phone number. For the example above: 58
    • [{your-phone}-cf7it-country-iso2]: Shows the country iso code. For the example above: ve
    • [{your-phone}-cf7it-national]: Shows the phone number without international prefix. For the example above: 2121234567

    You need to replace {your-phone} with the name of your form tag.

    Best regards,
    Yordan.

    Hello,

    Is there a possibility to show country code instead of flag on a contact form (not in an email)?

    Or do we need to mess with code?

    Best regards,

    Igor

    Plugin Author Yordan Soares

    (@yordansoares)

    Hello @igorbeuermann,

    Unfortunately, this extension doesn’t have an option to change the flags to the country code. Since it uses the International Telephone Input JavaScript library, it follows the options in that library.

    It’s possible that editing the code of the plugin or library you can achieve your goal, although right now I can’t give you any advice on how to do it because I never thought of such a thing.

    Best regards,
    Yordan.

    Thank you for your replay, Yordan!

    Actually I succeded to display what I wanted with CSS. This is of course a brute force solution but it does what I want. Unfortunately this is far from green coding …

    I made these lines in my style.css:

    .selected-flag { width: 66px; }
    
    .iti-flag {
    	display: none;
    	max-width: 0;
    }
    	
    .selected-dial-code {  padding-left: 0;}
    
    .flag-box { display: none; }

    Anybody using these lines will have to think about the CSS specificity in their own CSS rules.

    If somebody can point out where to make amendments in .js files I would be grateful.

    Regards,

    Igor

    One more thing I forgot:

    To see the result immediately you should set the geoIpLookup to null.

    Locate the variable declarations in the intlTelInput.min.js and in the variable h (that corresponds to defaults array variable of intlTelInput.js) set the following property:

    geoIpLookup:null

    Regards,

    Igor

    And one more – perhaps since the last update of the plugin:

    separateDialCode: false

    Igor

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘show country code on selected option’ is closed to new replies.