Title: autofill field
Last modified: February 9, 2023

---

# autofill field

 *  Resolved [asilentnaberbrane](https://wordpress.org/support/users/asilentnaberbrane/)
 * (@asilentnaberbrane)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/autofill-field/)
 * Hello, I’m using a jquery function to capture a value from the URL and then insert
   it into the form’s phone field. When I use it, I can actually populate the field,
   but for some reason, as soon as I click on the field, the value disappears. And
   more, when I submit the reservation, it records the value in another key, the
   same key as the URL (site.com/?key=274981279487). Can you help me? The function
   I use is this:
 *     ```wp-block-code
       function autopopulate_field() {
       ?>
       <script> 
       jQuery(document).ready(function($) {
       var param = new URLSearchParams(window.location.search);
       var value = param.get("param");
       if (value) {
       value = decodeURIComponent(value);
       value = atob(value);
       var intervalId = setInterval(function() {
       if ($("input[name='phone']").length) {
       $("input[name='phone']").val(value);
       clearInterval(intervalId);
       }
       }, 500);
       }
       });
       <script>
       <?php 
       } 
       add_action('wp_footer', 'autopopulate_field');
       ```
   
 * But I am willing to any other means as long as I can enter the URL data
    -  This topic was modified 3 years, 4 months ago by [asilentnaberbrane](https://wordpress.org/support/users/asilentnaberbrane/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [asilentnaberbrane](https://wordpress.org/support/users/asilentnaberbrane/)
 * (@asilentnaberbrane)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/autofill-field/#post-16455420)
 * I found out that it stores the value in the URL parameter array. So it doesn’t
   really work. If anyone has any suggestions I would appreciate it
 *  Thread Starter [asilentnaberbrane](https://wordpress.org/support/users/asilentnaberbrane/)
 * (@asilentnaberbrane)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/autofill-field/#post-16455492)
 *     ```wp-block-code
       function autopopulate_field() {
   
           ?>
   
           <script>    
   
           var phoneValue = '';
   
           jQuery(document).ready(function($) {
   
               var param = new URLSearchParams(window.location.search);
   
               var value = param.get("param");
   
               if (value) {
   
                   value = decodeURIComponent(value);
   
                   value = atob(value);
   
                   phoneValue = value;
   
                   var intervalId = setInterval(function() {
   
                       if ($("input[name='phone']").length) {
   
                           $("input[name='phone']").val(phoneValue);
   
                           clearInterval(intervalId);
   
                       }
   
                   }, 500);
   
               }
   
           });
   
           <script>
   
           <?php
   
       }
   
       add_action('wp_footer', 'autopopulate_field');
       ```
   
 *  Plugin Author [ameliabooking](https://wordpress.org/support/users/ameliabooking/)
 * (@ameliabooking)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/autofill-field/#post-16458825)
 * Hello, thank you for reaching out to us.
 * Unfortunately, this is currently not possible with the plugin’s built-in features,
   but our developers will work on implementing it in the future.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘autofill field’ is closed to new replies.

 * ![](https://ps.w.org/ameliabooking/assets/icon-256x256.png?rev=3429091)
 * [Booking for Appointments and Events Calendar - Amelia](https://wordpress.org/plugins/ameliabooking/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ameliabooking/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ameliabooking/)
 * [Active Topics](https://wordpress.org/support/plugin/ameliabooking/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ameliabooking/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ameliabooking/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [ameliabooking](https://wordpress.org/support/users/ameliabooking/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/autofill-field/#post-16458825)
 * Status: resolved