Skip to content

Instantly share code, notes, and snippets.

@Qubadi
Qubadi / gist:ac7a99a26331afc8b38c69a9ea3c570d
Created May 2, 2024 10:11
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').
@Qubadi
Qubadi / gist:3e11f72f65a6507e4d89dfd15f2b1873
Created February 16, 2024 16:42
JetFormBuilder submission feedback auto-scroll
Add the code to your snippet plugins, create a new js, javascript snippet, paste the code there and save it.
This script significantly improves the interaction with JetFormBuilder forms by automatically scrolling the
browser window to show success or error messages following a form submission. It is compatible with both AJAX and
traditional page reload submission methods. Regardless of the submission type, the script ensures the feedback
messages are immediately brought into view, smoothly guiding users to see their form submission outcome.
________________________________________________________________________________________
jQuery(document).ready(function($) {
function scrollToMessage() {