title: jQuery UI dialog closes on enter in input field
body: <p>I open my dialog with a button then I place my cursor in a input field and presses enter my dialog closes and this line is inserted to the address bar:</p>
  
  <p><a href="https://i.stack.imgur.com/IiLvX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IiLvX.png" alt="Address bar"></a></p>
  
  <p>jQuery:</p>
  
  <pre><code>$('#dialog').load("form-incident.php").dialog({
      title: "Add Incident",
      autoOpen: false,
      resizable: false,
      width: 800,
      modal:true,
      position: ['center', 'top+50'],
      buttons: {
          Add: function(){
               $.ajax({
                  url     : 'save.php',
                  type    : 'POST',
                  data    : $('form').serialize(),
                  context: $(this),
                  success: function (result) {
                      if (result === "true") {
                          alert('Incident has been added successfully');
                      } else {
                          alert('ERROR: Cannot insert data to MySQL table');
                      }
                      window.location.reload();
                      $(this).dialog( "close" );
                  },
                  error   : function(){
                      alert('ERROR: Check database connection');
                  }
              });
          },
          Cancel: function() {
              $(this).dialog( "close" );
          }
      }
  });
  </code></pre>
  
  <p>form-incident.php:</p>
  
  <pre><code>&lt;form&gt;
      Name: &lt;input type="text" name="name" id="name"&gt;&lt;br&gt;&lt;br&gt;
      Project:
      &lt;select name="project" id="project"&gt;
          &lt;option value="test"&gt;Test&lt;/option&gt;
      &lt;/select&gt;&lt;br&gt;&lt;br&gt;
      Incident:&lt;br&gt; &lt;textarea name="incident" id="incident" style="resize:none; width: 100%;" rows="14" cols="94"&gt;&lt;/textarea&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>How can I fix the problem so the dialog box does not close but still reacts to enter if there was some suggestions from earlier where the form was filled out?</p>