• Resolved kristennn

    (@kristennn)


    Hello,

    Is it possible to add country_code (ISO code of countries) to contact form 7 field? I’ve created a field named “country_code” and I want it to be hidden aka [hidden text country_code “country_code”] but the issue is, with ip2location-tags plugin, it does have brackets {ip:country_code} but when using that, nothing is happening so I wonder if CF7 has got a way to do this without involving myself in the code? If not and I have to do this via PHP code, please direct me to the place or tutorial that could help me with this.

    What I tried:
    https://ibb.co/gzddZGG
    https://ibb.co/ySQjvLF
    https://ibb.co/tmcN8yt

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter kristennn

    (@kristennn)

    Bump

    Thread Starter kristennn

    (@kristennn)

    Bump + not resolved

    idk how ip2location-tags works, but if I tried to solve this I would first try adding this below [hidden text country_code “country_code”] 

    <script type="text/javascript">
    var cc = {ip:country_code};
    document.getElementsByName("country_code")[0].value = cc;
    </script>

    If this doesn’t work try adding this instead

    <script type="text/javascript">
    <p id="countryCode" style="display:none">{ip:country_code}</p>
    <script type="text/javascript">
    var cc = document.getElementById("countryCode")[0].value;
    document.getElementsByName("country_code")[0].value = cc;
    </script>

    • This reply was modified 1 year, 11 months ago by cmrdk7.
    • This reply was modified 1 year, 11 months ago by cmrdk7.
    • This reply was modified 1 year, 11 months ago by cmrdk7.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Country code in CF7?’ is closed to new replies.