title: Submit a parent form with button click on a modal window
body: <p>I have a page which has a save button on click of this button opens a modal window which is basically comprises of an email template where the user has to enter comments and to input fields. There is a send and cancel button on the modal window. If cancel button is clicked it just submits the parent page and doesn't save the email template values for sending email. But if send button is clicked then the email template values for sending the email and the parent page values are submitted. Currently the cancel button functionality is working but send button is not working as expected. Whenever I click send button the page gets hang and doesn't process further. Can anyone help me out with a solution to it.</p>
  
  <pre><code> $("#emailBackBtn").click(function(){               
               var zIndex = 1000 + (10 * $('.modal:visible').length);
               $(this).css('z-index', zIndex);             
              $("#dialog-send").dialog({
                      resizable : false,
                      height : 200,
                      modal : true,
                      closeOnEscape : false,
                      dialogClass : "no-close",   
                      open : function(type, data)
                      {
                          $('.ui-dialog').css('z-index', 9999);
                          $('.ui-widget-overlay').css('z-index', zIndex);                        
                      },                     
                      buttons :
                          [
                              {
                                  text : "Yes",
                                  type : "submit",
                                  click : function()
                                  {                                       
                                      $(this).dialog("close");    
                                      $('#sendEmailOrPopup').modal('hide');
                                      $("#quotLineEntry").submit();
                                  }
  
                              },
                              {
                                  text : "No",
                                  type : "button",
                                  click : function(){                                     
                                      $(this).dialog("close");
                                  }
                              }
                           ]
              });
           });
  
  
          $('#emailSendBtn').click(function(){                
               $("#emailCc").val($('#cc').val());
               $("#emailComment").val($('#comment').val());   
               $("#emailTo").val($('#to').val());
               $("#emailBody").val($('#body').html());
               $("#emailSubject").val($('#subject').val());
               $("#emailFrom").val($('#from').val());             
               $("#quotLineEntry").submit();
           });
  </code></pre>
  
  <p>Above are the two buttons functionality in modal window using Jquery. once the send button is click the form is submitted to spring controller.</p>
  
  <p><code>#quotLineEntry</code> is the form present in parent page. <code>#sendEmailOrPopup</code> is the modal window.</p>