Title: Conditionally hide Submit button
Last modified: October 27, 2018

---

# Conditionally hide Submit button

 *  Resolved [mpbaweb](https://wordpress.org/support/users/mpbaweb/)
 * (@mpbaweb)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/conditionally-hide-submit-button/)
 * Hi
    Is it possible to control the display of the submit and captcha fields depending
   on a form field. For example, I ask a simple yes/no question at the very beginning
   of the form and if the user replies ‘Yes’, none of the fields are displayed except
   a text field which tells the user he must use a different form with a hyperlink.
   However, the Submit button and captcha are still visible. I want to only show
   these if the user selects ‘No’
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fconditionally-hide-submit-button%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/conditionally-hide-submit-button/#post-10822311)
 * Hello [@mpbaweb](https://wordpress.org/support/users/mpbaweb/),
 * The fields your are referring (the captcha and submit button) cannot be defined
   as dependents, but you can show/hide them programmatically.
 * – Insert a “HTML Content” field in the form, and enter the following piece of
   code as its content:
 *     ```
       <script>
       jQuery(document).on('change', '[id*="fieldname57_"]', function(){
       var action = 'show';
       if(jQuery('[id*="fieldname57_"]:checked').val()=='Yes') action = 'hide';
       jQuery('.captcha,.pbSubmit')[action]();
       });
       </script>
       ```
   
 * and that’s all.
    Best regards.
 *  Thread Starter [mpbaweb](https://wordpress.org/support/users/mpbaweb/)
 * (@mpbaweb)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/conditionally-hide-submit-button/#post-10823003)
 * Perfect!
    The support for this plugin is absolutely first class!
 *  [amirdorna](https://wordpress.org/support/users/amirdorna/)
 * (@amirdorna)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/conditionally-hide-submit-button/#post-10865033)
 * [@codepeople](https://wordpress.org/support/users/codepeople/)
    I want it on 
   the reverse mode, I mean, id a field is checkmarked, then it shows the submit
   button.
 * I tried to replace ‘show’ and ‘hide’ but didn’t work
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/conditionally-hide-submit-button/#post-10865179)
 * Hello [@amirdorna](https://wordpress.org/support/users/amirdorna/),
 * If you want show a submit button when a checkbox or radio button is checked, 
   the process is very straightforward:
 * – Select the “No” option for the attribute: “Display submit button?” in the form’s
   settings.
 * – Insert a button in the form, and convert it in a submit button entering as 
   its onclick event, the piece of code:
 *     ```
       jQuery(this.form).submit();
       ```
   
 * – Select the radio button or checkbox field in the form, and then, click on the
   link: “Show dependencies” in its settings (specifically in the choices section)
 * – And finally, select the button field from the list of dependent fields corresponding
   to the choice.
 * Best regards.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Conditionally hide Submit button’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

## Tags

 * [hide](https://wordpress.org/support/topic-tag/hide/)
 * [submit](https://wordpress.org/support/topic-tag/submit/)

 * 4 replies
 * 3 participants
 * Last reply from: [codepeople](https://wordpress.org/support/users/codepeople/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/conditionally-hide-submit-button/#post-10865179)
 * Status: resolved