Gravity Forms Button Text

Question

I am creating several Gravity Forms that use a button instead of an input to submit. I got the button working, but I was wondering how I can use the button text in the admin panel, instead of hard-coding the value?

Screenshot: https://ibb.co/4MtGMmZ

Here is my button code:

add_filter( 'gform_submit_button', 'form_submit_button', 10, 2 );
function form_submit_button( $button, $form ) {
    return "<button class='submit-button' id='gform_submit_button_{$form['id']}'><span><i class='far fa-envelope'></i>Submit</span></button>";
}

Obviously, you can see the hard-coded Submit text

I tried:

add_filter( 'gform_submit_button', 'form_submit_button', 10, 2 );
function form_submit_button( $button, $form ) {
    return "<button class='submit-button' id='gform_submit_button_{$form['id']}'><span><i class='far fa-envelope'></i>".$button."</span></button>";
}

Which puts the input in my button 🙁 instead of just return the button value

I thought about two possibilities…either pulling that variable from the admin panel page (in the form settings) or if it was possible to have different button code, based on the form, that would work too. Not my favorite option, because the user would not have any control over the value – but I don’t even know if that’s an option either.

Any help is appreciated!

Thanks,
Josh

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/gravity-forms-button-text/">

Gravity Forms Button Text</a>
0
, , Josh Rodgers 2 months 0 Answers 69 views 0

Leave an answer