Don’t use the method provided in Gravity Forms documentation as it strips out important attributes.
<?php
/**
* Change submit from input to button
*
* Do not use example provided by Gravity Forms as it strips out the button attributes including onClick
*/
function wd_gf_update_submit_button( $button_input, $form ) {
//save attribute string to $button_match[1]
preg_match( "/<input([^\/>]*)(\s\/)*>/", $button_input, $button_match );
//remove value attribute (since we aren't using an input)
$button_atts = str_replace( "value='" . $form['button']['text'] . "' ", "", $button_match[1] );
// create the button element with the button text inside the button element instead of set as the value
return '<button ' . $button_atts . '><span>' . $form['button']['text'] . '</span></button>';
}
add_filter('gform_submit_button', 'wd_gf_update_submit_button', 10, 2);