• Resolved guglielmirent

    (@guglielmirent)


    Good morning, congratulations on your extension it is really comprehensive, I would like to understand how to retrieve a field (number) as a parameter in a link, I have parameters in the page and I would like clicking on the link to insert them in my ContactForm7
    I attach screenshots of the acf and the link
    is this possible?
    I also have a script to retrieve the link parameters in CF7 I also attach script
    Could you help me?

    [

    function reply_click(element)
    {
    document.getElementById(‘parametro1’).value = element.getAttribute(‘parametro1’);
    document.getElementById(‘parametro2’).value = element.getAttribute(‘parametro2’);
    document.getElementById(‘parametro3’).value = element.getAttribute(‘parametro3’);
    }

    link: href="#" class="bottone" onclick="reply_click(this)" parametro1="mio valore" parametro2="parametro" parametro3="$get_field( 'km1' )"

    in red color are ACF fields

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter guglielmirent

    (@guglielmirent)

    I am trying another way, I created a .js and uploaded it to the theme folder, the file was called in function.php and is correctly loaded

    but it still doesn’t return the values in the form

    I write the script

    jQuery(document).ready(function($) {
      $('a[data-acf]').click(function(e) {
        e.preventDefault();
        var field_name = $(this).data('acf');
        var field_value = get_field(field_name);
        if (field_value) {
          var form_id = '378'; // inserisci l'id del form CF7 qui
          var input_name = $('#' + form_id + ' input[name="text-639"]'); // sostituisci "text-639" con il nome del tuo campo di input CF7
          input_name.val(field_value);
        }
      });
      
      function get_field(name) {
        return $('#acf-field_63f6169af3571').val(); // sostituisci con il selettore corretto per il tuo campo personalizzato ACF
      }
    });

    I sincerely hope that you will help me out.

    The plugin is wonderful, but a little assistance would also be appreciated

    Plugin Support ACF Support

    (@acfsupport)

    Hi @guglielmirent

    ACF Support Team here. This forum is generally used by ACF users helping each other out.

    However, we would love to continue investigating and troubleshooting this issue, please can you create a ticket using our support form and we can look into it further.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Acf get_field value in link parameter’ is closed to new replies.