title: Submitting form from dialog if the same form exists in the main form as well
body: <p>I have a peculiar problem. I have a form and I use that for editing each existing employee data. If the user wants to create a new employee, he clicks a button and a modal dialog opens with the same form displayed in the dialog and I am setting a hidden field's value to 'Create' to indicate the form is in create mode as opposed to 'Edit' mode. I am using ajax to submit the form to a asp.net handler to process the form data. Here is a part of the code I am using to submit the form to the handler (frmHPHirerGuarantor is the ID of the form)</p>
  
  <pre><code>function SaveHPHirer(formMode) {
          if (formMode == 'Edit') {
              $('#formState').val('Edit');
              $('#txtCaseNo').prop('readonly', true);
          }
          else {
              $('#formState').val('Create');
              $('#txtCaseNo').prop('readonly', false);            
          }
          $.post("Handlers/ManageHPHirer.ashx?method=createNewHPHirer", $("#frmHPHirerGuarantor").serialize())
  .done(function (data) {
      if (data.trim().length &gt; 0) {
          $("#sent").text("Error");
         }
      else {
          $("#sent").text("Success");
         }
     });
  
   }
  </code></pre>
  
  <p>Now, the problem is, if I submit the form from within the dialog, the form that is in the main page is being serialized and not the one in the dialog, ostensibly because they have the same Id. But I do not want this behavior. Is there I way I ca submit the form in the dialog without having to create a separate form for creating employee?</p>