PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

filter the Gravity Forms button type

  1. // filter the Gravity Forms button type

    I have been successfully able to get this filter to work for the Submit button, but not the previous or next buttons. Is there something simple I am missing here?

    looks like this code only covers the submit button, and not the other two:

    // filter the Gravity Forms button type
    add_filter("gform_submit_button", "form_submit_button", 10, 2);
    function form_submit_button($button, $form){
        return "<button class='btn' id='gform_submit_button_{$form["id"]}'><span>Submit</span></button>";
    }
    Posted 12 years ago on Saturday May 14, 2011 | Permalink
  2. Any help gentleman on this issue?

    Posted 12 years ago on Monday May 16, 2011 | Permalink
  3. There isn't a corresponding hook for the Next/Previous buttons in multi-page forms because of how multi-page forms work they can't be manipulated and changed, otherwise you could break the functionality.

    What are you trying to accomplish?

    Posted 12 years ago on Monday May 16, 2011 | Permalink
  4. I am just trying to get the NEXT and PREVIOUS buttons to match my site.

    notice the buttons:
    http://www.simplecom.net/

    free form plugin uses the theme's CSS:
    http://www.simplecom.net/contact/

    However, I can't get your form to use it (look at the next button at the bottom, click it, and you can see the buttons on the next page as well.

    http://www.simplecom.net/order-cloud-server-standard/

    Thanks for any insight you can provide

    Posted 12 years ago on Monday May 16, 2011 | Permalink
  5. Have you looked at the documentation for how to target and style form fields? It has a section on Multi-Page forms, including the Next/Previous buttons and how to target them with CSS in order to style them however you want:

    http://www.gravityhelp.com/documentation/page/CSS_Targeting_Samples#Multi-Page_Form_Fields_.E2.80.93_NEW_for_version_1.5

    Posted 12 years ago on Monday May 16, 2011 | Permalink
  6. I am getting closer with that last input from you, thanks.

    As you can see, only half of the button is displayed.

    The theme's CSS relies on three .btn classes

    [css]
    .btn {
          	padding: 8px 0 10px 20px;
            background: transparent url(img/bg-btn.png) no-repeat left top;
            color: #626262!important;
            font-size: 11px;
            font-weight: bold;
            text-decoration: none;
            text-transform: uppercase;
            text-shadow: 1px 1px 0 #fff;
            letter-spacing: .03em;
    }
    
    .btn span {
    	padding: 8px 40px 10px 0;
            background: transparent url(img/bg-btn-span.png) no-repeat right top;
    {
    
    a.btn:hover {
    	color: #424242!important;
    }
    Posted 12 years ago on Monday May 16, 2011 | Permalink
  7. That's because the current button markup is different than the others and doesn't include a span which your theme is using for the end section. You can create your own button markup to add the span using the "gform_submit_button" filter.

    http://www.gravityhelp.com/documentation/page/Gform_submit_button

    Posted 12 years ago on Tuesday May 17, 2011 | Permalink
  8. But now we are back to square one, you can use the filter via the submit button, but how to do so for the previous and next buttons?

    Posted 12 years ago on Tuesday May 17, 2011 | Permalink
  9. Ha, true. Sorry about that. You may have to use jQuery to replace the markup. The low-tech way would be to make image buttons that have the same style as the others and use those.

    Here's a couple of quick ones I threw together as an example.

    http://j.mp/k83Eeb
    http://j.mp/lOYZR8
    http://j.mp/kF79eN

    Posted 12 years ago on Tuesday May 17, 2011 | Permalink
  10. Well, not the method I was hoping for, but at least it takes care of this issue and I can press on. Perhaps you can work it so the next release is a little more theme friendly.

    However, with that said, you taking the time to create the button images is greatly appreciated.

    Posted 12 years ago on Tuesday May 17, 2011 | Permalink
  11. Understood. We're always looking for ways to improve & enhance the plugin. We'll keep this in mind as well and see what we can come up with.

    Posted 12 years ago on Tuesday May 17, 2011 | Permalink