title: Warn user when form contains unsaved data, ignoring data table filter fields
body: <p>I'm searching for a way to warn the user that inside the form is unsaved data.
  The warning should appear if the user navigates to another site or if he closes the browser.
  I found <a href="https://stackoverflow.com/questions/5709356/warn-user-of-unsaved-data-in-jsf">this solution</a> which kind of works. Sometimes it does not react if browser gets closed.</p>
  
  <pre><code>&lt;script src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      $(document).ready(function() {
          // Set the unload message whenever any input element get changed.
          $(':input').change(function() {
              setConfirmUnload(true);
          });
  
          // Turn off the unload message whenever a form get submitted properly.
          $('form').submit(function() {
              setConfirmUnload(false);
          });
      });
  
      function setConfirmUnload(on) {
          var message = "You have unsaved data. Are you sure to leave the page?";
          window.onbeforeunload = (on) ? function() { return message; } : null;
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Now I have one Problem.
  I've got a <code>&lt;p:datatable&gt;</code> on my page. Each column has a filter field. Since this field is also a input field the selector also matches if something is in the filter field.
  Is it possible to avoid that the selector checks the filter fields.</p>