Skip to content

Instantly share code, notes, and snippets.

@shaydmax21
shaydmax21 / gist:478f8bbc1ce3353f9fe16e0310eed809
Created June 22, 2024 05:31 — forked from Qubadi/gist:ac7a99a26331afc8b38c69a9ea3c570d
Jetformbuilder form, A custom code for auto detect country and land code phone ( New style and new version ).
1. Start by creating a new PHP snippet. Paste your custom code into it and set it to run "everywhere".
2. Create a text field, set the type to "tel", and name the form field "phone".
3. Create a select field, set it to "manual input" (do not add any options), and name the form field "country".
4. Create a hidden field named "full_phone_number" for storing the full phone number.
5. Create another hidden field named "full_country_name" for storing the full country name.
6. Add both hidden fields to the "Post Submit Action" section under "Content".
7. Update the page slug name to the specific page where you have added the form. For instance, if
the current page slug name is "contact", change it to match the URL of the page where the form is placed.
8. Finally, register for an account at https://ipinfo.io/signup ,to obtain a token key. Then,
integrate the token into your fetch request as follows: fetch('https://ipinfo.io?token=YOUR_TOKEN_KEY_HERE').