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?
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?
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.
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!