title: jQuery Validation plugin: prompt for override
body: <p>I have a jQuery form that has validation of a sort.  It is a data entry screen with two text boxes on it.  Each text box has a aloud value of 1 to infinity, but a 'desired' range of 36-84 for the first control and 50-300 for the second. If the value is within the desired range, then the submit is to go through.  If the range is outside the desired, but within the aloud, say 25 for either, then the user need to be prompted AFTER they press submit.  If they say yes to the prompt, the submit goes through, if they say no, it does not.</p>
  
  <p>Thanks to the help of Cooper Maruyama, I have gotten to the point of trying to actually implement the answer in ASP.Net world.  The issue is that the text box id's are determined at run time and are passed in to the initialize function in a ids object.  </p>
  
  <p>When I run it, I get the following errors: <em>Unable to get value of the property 'settings': object is null or undefined</em></p>
  
  <p>Here is my code:</p>
  
  <pre><code>var manageResidentWeightsJs = {
  
      initialize: function (ids) {
  
          var cbDeclined = $(ids.cbDeclined);
          var cbIsOutOfFac = $(ids.cbIsOutOfFac);
  
          $('&lt;div id=errorSummary&gt;The following values fall out side of the normal range:&lt;/div&gt;')
                  .append('&lt;ul id="errorsList"&gt;&lt;/ul&gt;').hide().insertAfter(ids.formView);
  
          var txtHeight = $(ids.txtHeight);
          var txtWeight = $(ids.txtWeight);
  
          function confirmation() {
              var x;
              var r = confirm("Are you sure?");
              if (r == true) { return true; }
              else { return false; }
          }
  
          $(ids.formView).validate({
              invalidHandler: function (form, validator) {
                  if (confirmation()) { form.submit(); }
              }
          });
  
          txtHeight.each(function (index, elem) { $(elem).rules("add", { min: 0 }) });
          txtWeight.each(function (index, elem) { $(elem).rules("add", { min: 0 }) });
      }
  }
  </code></pre>
  
  <p>The follow code is being used to call the above code.  In this code the ASP.Net has been replaced with the '#' as to eliminate the ASP.Net factor from the problem:)</p>
  
  <pre><code>$(document).ready(function () {
      var ids = {
        formView: '#mainForm',
        txtHeight: '#heightCtrl',
        txtWeight: '#weightCtrl'
      };
  
      manageResidentWeightsJs.initialize(ids);
  });
  </code></pre>