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.

Location to insert form submission hooks

  1. wollemi
    Member

    I tried adding these form submission hooks in functions.php as well as within the template that displays the form but it does not seem to work. What am I doing wrong?

    Posted 12 years ago on Thursday January 19, 2012 | Permalink
  2. Please explain what you are trying to do. Are you trying to use the PHP function call to insert a form? If so, you would insert the function call into the template file, not functions.php. If it's not working, is it possible the form uses conditional logic? If so, that is likely because when using the function call to insert a form, you also need to enqueue the Gravity Forms scripts, otherwise, the form will be hidden.

    Embedding the form with the function call:
    http://www.gravityhelp.com/documentation/page/Embedding_A_Form#Function_Call

    Enqueuing your own scripts is also required:
    http://www.gravityhelp.com/documentation/page/Gravity_form_enqueue_scripts

    If none of that helps you, please share a URL to your site, and explain what code you are trying to add, exactly, and where you tried adding it. Thank you.

    Posted 12 years ago on Friday January 20, 2012 | Permalink
  3. Jamison
    Member

    I have the same issue, when I tried to insert the simple code (see below) to generate a random number in the template functions.php file:

    add_filter("gform_field_value_uuid", "uuid");
    function uuid($prefix = '')
    {
    $chars = md5(uniqid(mt_rand(), true));
    $uuid = substr($chars,0,8) . '-';
    $uuid .= substr($chars,8,4) . '-';
    $uuid .= substr($chars,12,4) . '-';
    $uuid .= substr($chars,16,4) . '-';
    $uuid .= substr($chars,20,12);
    return $prefix . $uuid;
    }

    I've made sure that the parameter name is set to uuid in the form and I can't get the code to generate a random number. I am not sure what else I needed to do on top of adding the code to the template functions.php file. Please assist. I've been stuck trying to troubleshoot this for many hours. Thanks!

    Posted 12 years ago on Monday April 2, 2012 | Permalink