PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Pre-populating (again)

  1. Dipity2
    Member

    I have the following problem. I have a paragraph text box that I want pre-populated within the form. I've added this to my functions.php file, but it isn't working. I've probably got something wrong somewhere!

    add_filter("gform_field_value_enquiry", "populate_enquiry");
    function populate_enquiry(){
    global $post;
    $post_name = $post->post_title;
    $enquiry_total = "Please send me more information on" .$post_name. "!";
    return $enquiry_total;
    }
    

    My paragraph text box is ticked to allow dynamic population, and called 'enquiry'.

    Posted 14 years ago on Tuesday October 27, 2009 | Permalink
  2. I don't see anything wrong with your code.
    What I would do is change your populate_enquiry() function to something trivial, like:

    function populate_enquiry(){
    return "Testing enquiry";
    }

    If that doesn't work, make sure there aren't any blank spaces around the 'enquity' parameter name.

    If you still can't get it to work, I will need to take a closer look at it. Please email me at alex[at]rocketgenius.com and we can go from there.

    Posted 14 years ago on Tuesday October 27, 2009 | Permalink
  3. Dipity2
    Member

    It still doesn't work, I'm emailing you now.

    Posted 14 years ago on Tuesday October 27, 2009 | Permalink
  4. The code above looks good. The problem was that it wasn't being added to the right file (the current theme's function.php). Once it was added to the right file, it worked correctly.

    Posted 14 years ago on Wednesday October 28, 2009 | Permalink
  5. Dipity2
    Member

    Yes, I just want to say thankyou to Alex, he helped me out enormously - and I want to stress it was ME at fault, not the software!

    Thanks once again :)

    Posted 14 years ago on Wednesday October 28, 2009 | Permalink