Taken from Gist here: https://gist.github.com/mannieschumpert/8334811
Filter the submit button in Gravity Forms to change the <input type="submit> element to a <button> element.
There's an example in the Gravity Forms documentation, but it lacks the proper code to show your custom button text, AND removes important attributes like the onclick that prevents multiple clicks. I was trying to solve that.
[php]function gf_make_submit_input_into_a_button_element($button_input, $form) {
//save attribute string to $button_match[1]
preg_match("/<input([^\/>]*)(\s\/)*>/", $button_input, $button_match);
//remove value attribute
$button_atts = str_replace("value='".$form['button']['text']."' ", "", $button_match[1]);
return '<button '.$button_atts.'>'.$form['button']['text'].'<i class="fa fa-refresh"></i></button>';
}
add_filter('gform_submit_button', 'gf_make_submit_input_into_a_button_element', 10, 2);[/php]
Revisions
- May 1, 2015 @ 01:13:34 [Current Revision] by PeterLugg
- May 1, 2015 @ 01:13:34 by PeterLugg
Revision Differences
There are no differences between the May 1, 2015 @ 01:13:34 revision and the current revision. (Maybe only post meta information was changed.)
No comments yet.