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.

Conditional logic on Submit button with Custom Filter Style

  1. hasanilx
    Member

    I setup a filter for my buttons and it works fine, but I notice that now I can't add conditional logic to the submit buttons. How can I have custom submit buttons and have conditional logic show submit button.

    add_filter("gform_submit_button", "form_submit_button", 10, 2);

    ThX

    Posted 11 years ago on Saturday April 20, 2013 | Permalink
  2. hasanilx
    Member

    Anyone?

    Posted 11 years ago on Thursday May 9, 2013 | Permalink
  3. David Peralty

    Can you provide us with more information please? What customizations have you made to your submit button? What kind of conditional logic are you trying to add? What happens?

    Posted 11 years ago on Thursday May 9, 2013 | Permalink
  4. hasanilx
    Member

    http://198.1.66.203/~hx2admin/gift

    I created a filter in functions.php to change the look of form buttons. But now the conditional logic to show buttons doesn't work. For example in the sample link abovr the user should have to select yes or no to display the form submission button. If I remove the filter the conditional logic works just fine.

    Here is the filter added
    add_filter("gform_submit_button_7", "form_submit_button7", 10, 2);
    function form_submit_button7($button, $form){
    return "" . $form["button"]["text"] . "";
    }

    Posted 11 years ago on Thursday May 9, 2013 | Permalink
  5. hasanilx
    Member

    It works now using this code. I don't know exactly why but it works. Instead of setting up styles within each form I added a dynamic css call to gvg-btn-formid. That way I can add individual styles to different butons. Before I was setting up a filter for each button as each button needed to be different (size, padding, etc.). This is more elegant.

    // 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 btn-danger btn-flat gvf-btn-" . $form["id"] . "' id='gform_submit_button_{$form["id"]}'><span>" . $form["button"]["text"] . "</span></button>";
    }

    Posted 11 years ago on Friday May 10, 2013 | Permalink
  6. David Peralty

    Glad you got it sorted. All my best!

    Posted 11 years ago on Friday May 10, 2013 | Permalink