title: Why is my form's submit button not working?
body: <p>I am modifying a WP plugin (PHP; latest version of WP). It has a form where a user can ask a question. It came with it's own submit button. I found an action hook where I can add my own code to the form, so I added Braintree's simplest payment form - the DropIn UI. <a href="http://imgur.com/7hbNpjv" rel="nofollow">This is a screenshot of what both forms look like when I set them up</a>.</p>
  
  <p><strong>The problem:</strong></p>
  
  <p>The "Post question" button that came with the plugin is not working and I suspect that it is due to the presence of the second form. </p>
  
  <p><strong>What I've tried:</strong></p>
  
  <p>I removed bits and pieces of the code I added to try and single out what could be causing this and it came down to the DropIn's form code itself. The presence of a 2nd form on this page is causing an issue.</p>
  
  <p><strong>My question:</strong> What could cause submit issues when 2 forms are present on one page? </p>
  
  <hr>
  
  <p><strong>Note</strong> - I used an action hook to insert my code to a function that described itself as the main plugin's form footer. I am getting the feeling that this is a form nesting problem.</p>
  
  <p><strong>my function that creates the Braintree form:</strong></p>
  
  <pre><code>class FD_Braintree_Form
  {
      public function fd_bt_form()
          {
  
              echo 
  
                  '&lt;form id="checkout" action="/process-trans.php" method="post"&gt;
  
                    &lt;p&gt;
                      &lt;label&gt;&lt;font size="5"&gt;Amount:&lt;/font&gt;&lt;/label&gt;
                      &lt;input type="text" size="4" name="amount" /&gt;
                    &lt;/p&gt;
  
                    &lt;div id="payment-form"&gt;&lt;/div&gt;
  
                    &lt;input type="submit" value="Pay" /&gt;
  
                  &lt;/form&gt;';
  
          }
  }
  </code></pre>
  
  <p><strong>my function that generates the Braintree form:</strong></p>
  
  <pre><code>class Find_Do_For_Anspress
  {
     add_action('ap_form_bottom_ask_form', array( $this, 'fd_bt_form_html')); //This is where I use the action hook to insert my code into the plugin's form_footer()
  
     public function fd_bt_form_html()
          {       
              $class_bt_token = new Braintree_ClientToken();
              $clientToken = $class_bt_token-&gt;generate();
  
              ?&gt;
              &lt;script src="https://js.braintreegateway.com/v2/braintree.js"&gt;&lt;/script&gt;
              &lt;script&gt;
  
                  braintree.setup(
                  '&lt;?php echo $clientToken ?&gt;',
                  'dropin', {
                    container: 'payment-form',
                  }); 
  
              &lt;/script&gt;
              &lt;?php       
  
              $class_bt_form = new FD_Braintree_Form();
              $bt_form = $class_bt_form-&gt;fd_bt_form();
  
              echo $bt_form;
          }
  }
  </code></pre>
  
  <p><strong>plugin's main code that generates the question form:</strong></p>
  
  <pre><code>function ap_ask_form($editing = false){
      global $editing_post;
  
      $is_private = false;
      if($editing){
          $is_private = $editing_post-&gt;post_status == 'private_post' ? true : false;
      }
  
      $args = array(
          'name'              =&gt; 'ask_form',
          'is_ajaxified'      =&gt; true,
          'submit_button'     =&gt; ($editing ? __('Update question', 'ap') : __('Post question', 'ap')),
          'fields'            =&gt; array(
              array(
                  'name' =&gt; 'title',
                  'label' =&gt; __('Title', 'ap'),
                  'type'  =&gt; 'text',
                  'placeholder'  =&gt; __('Question in one sentence', 'ap'),
                  'desc'  =&gt; __('Write a meaningful title for the question.', 'ap'),
                  'value' =&gt; ( $editing ? $editing_post-&gt;post_title : sanitize_text_field( @$_POST['title'] ) ),
                  'order' =&gt; 5,
                  'attr' =&gt; 'data-action="suggest_similar_questions"',
                  'autocomplete' =&gt; false,
              ),
              array(
                  'name' =&gt; 'title',
                  'type'  =&gt; 'custom',
                  'order' =&gt; 5,
                  'html' =&gt; '&lt;div id="similar_suggestions"&gt;&lt;/div&gt;'
              ),
              array(
                  'name' =&gt; 'description',
                  'label' =&gt; __('Description', 'ap'),
                  'type'  =&gt; 'editor',
                  'desc'  =&gt; __('Write description for the question.', 'ap'),
                  'value' =&gt; ( $editing ? apply_filters('the_content', $editing_post-&gt;post_content) : @$_POST['description']  ),
                  'settings' =&gt; apply_filters( 'ap_ask_form_editor_settings', array(
                      'textarea_rows'     =&gt; 8,
                      'tinymce'           =&gt; ap_opt('question_text_editor') ? false : true,
                      'quicktags'         =&gt; ap_opt('question_text_editor') ? true : false ,
                      'media_buttons'     =&gt;false,
                  )),
              ),
              array(
                  'name'  =&gt; 'ap_upload',
                  'type'  =&gt; 'custom',
                  'html' =&gt; ap_post_upload_form(),
                  'order' =&gt; 10
              ),
              array(
                  'name' =&gt; 'parent_id',
                  'type'  =&gt; 'hidden',
                  'value' =&gt; ( $editing ? $editing_post-&gt;post_parent : get_query_var('parent')  ),
                  'order' =&gt; 20
              )
          ),
      );
  
      if(ap_opt('allow_private_posts'))
          $args['fields'][] = array(
              'name' =&gt; 'is_private',
              'type'  =&gt; 'checkbox',
              'desc'  =&gt; __('Only visible to admin and moderator.', 'ap'),
              'value' =&gt; $is_private,
              'order' =&gt; 12,
              'show_desc_tip' =&gt; false
          );
  
      if(ap_opt('recaptcha_site_key') == '')
          $reCaptcha_html = '&lt;div class="ap-notice red"&gt;'.__('reCaptach keys missing, please add keys', 'ap').'&lt;/div&gt;';
      else
          $reCaptcha_html = '&lt;div class="g-recaptcha" id="recaptcha" data-sitekey="'.ap_opt('recaptcha_site_key').'"&gt;&lt;/div&gt;&lt;script type="text/javascript"
  src="https://www.google.com/recaptcha/api.js?hl='.get_locale().'&amp;onload=onloadCallback&amp;render=explicit"  async defer&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;var onloadCallback = function() {
          widgetId1 = grecaptcha.render("recaptcha", {
            "sitekey" : "'.ap_opt('recaptcha_site_key').'"
          });
        };&lt;/script&gt;';
  
      if(ap_opt('enable_recaptcha'))
          $args['fields'][] = array(
              'name' =&gt; 'captcha',
              'type'  =&gt; 'custom',
              'order' =&gt; 100,
              'html' =&gt; $reCaptcha_html
          );
  
      /**
       * FILTER: ap_ask_form_fields
       * Filter for modifying $args
       * @var array
       * @since  2.0
       */
      $args = apply_filters( 'ap_ask_form_fields', $args, $editing );
  
      if($editing){
          $args['fields'][] = array(
              'name'  =&gt; 'edit_post_id',
              'type'  =&gt; 'hidden',
              'value' =&gt; $editing_post-&gt;ID,
              'order' =&gt; 20
          );
      }
  
      $form = new AnsPress_Form($args);
  
      echo $form-&gt;get_form();
      echo ap_post_upload_hidden_form();
  }
  </code></pre>
  
  <p><strong>the plugin's "form footer" code and the action hook I used:</strong></p>
  
  <pre><code>private function form_footer()
      {
          ob_start();
          /**
           * ACTION: ap_form_bottom_[form_name]
           * action for hooking captcha and extar fields
           * @since 2.0.1
           */
          do_action('ap_form_bottom_'. $this-&gt;name);
          $this-&gt;output .= ob_get_clean();
  
          $this-&gt;output .= '&lt;button type="submit" class="ap-btn ap-btn-submit"&gt;'.$this-&gt;args['submit_button'].'&lt;/button&gt;';
  
          if(@$this-&gt;args['show_cancel'] === true)
              $this-&gt;output .= '&lt;button type="button" class="ap-btn ap-btn-cancel"&gt;'.__('Cancel', 'ap').'&lt;/button&gt;';
  
          $this-&gt;output .= '&lt;/form&gt;';
      }
  </code></pre>
  
  <p><strong>the hidden upload function:</strong></p>
  
  <pre><code>function ap_post_upload_hidden_form(){
      if(ap_opt('allow_upload_image'))
          return '&lt;form id="hidden-post-upload" enctype="multipart/form-data" method="POST" style="display:none"&gt;
              &lt;input type="file" name="post_upload_image" class="ap-upload-input"&gt;
              &lt;input type="hidden" name="ap_ajax_action" value="upload_post_image" /&gt;
              &lt;input type="hidden" name="ap_form_action" value="upload_post_image" /&gt;
              &lt;input type="hidden" name="__nonce" value="'.wp_create_nonce( 'upload_image_'.get_current_user_id()).'" /&gt;
              &lt;input type="hidden" name="action" value="ap_ajax" /&gt;
          &lt;/form&gt;';
  }
  </code></pre>
  
  <p><strong>the HTML that houses the plugin's ask form code:</strong></p>
  
  <pre><code>&lt;div class="ap-tab-container"&gt;
          &lt;div id="ap-form-main" class="active ap-tab-item"&gt;
              &lt;?php ap_ask_form(); ?&gt;
          &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>