Change Element's Name Attribute in Gravity Forms Change Element's Name Attribute in Gravity Forms wordpress wordpress

Change Element's Name Attribute in Gravity Forms


It isn't the most beutiful code, and I'm not sure if there is a gravity forms approved way (it wasn't apparent to me), but something like this should work for you.

<script type="text/javascript">    jQuery(document).ready(function() {             jQuery('#input_1').attr('name','YOURCUSTOMNAMEVALU');    });</script>

Also, for WordPress you should probably wrap it in a scope to contain this to the page that contains your form.

Something like

<?phpif(is_page('forms-page') && !is_admin()) {?>//Javascript Here<?php } ?>

For style points you can use enqueue_script to include it from your functions.php


Set the parameter name to something like 'customparam'.

Then dynamically populate it using a filter.

add_filter('gform_field_value_customparam', 'populate_customparam');function populate_customparam($value){    return 'Hello';}

This will dynamically insert 'Hello' into every gravity form field with parameter named 'customparam'