Custom Input Names on GravityForms Custom Input Names on GravityForms wordpress wordpress

Custom Input Names on GravityForms


After contacting the makers of Gravity Forms, it sounds like they don't support custom input names. As a workaround, I wrote a bit of jQuery to rename inputs with the correct form names. For example:

$("input#input_1_1").attr("name","first_name");


Just put some code in functions.php and fill out the form which will then email you with a list of the id names, they are the same names that you can fine using developer tools etc. This was just faster for me. Then change the code to have it post via curl with different input names.

This uses php so it's on the server to handle. That way you don't have to worry about people with JS disabled in their browser.

http://0to5.com/gravity-forms-submitting-forms-to-3rd-party-applications/


Add a new field (HTML field). In content settings of this field add this javascript with script tags

Non-jquery solution:

document.getElementById("input_14_4").setAttribute("name", "email");

Another solution i found here

https://docs.gravityforms.com/gform_field_content/

add_filter( 'gform_field_content', function ( $field_content, $field , $value, $lead_id, $form_id) { if ( $form['id'] != 14 ) {        //not the form whose tag you want to change, return the unchanged tag        return $field_content;    }    if ( $field->id == 3 ) {        return  preg_replace( "|name='(.*?)'|", "name='email'", $field_content );    }      return $field_content;}, 10, 5 );