jQuery validation rules: selectively validate rule

jQuery validation rules: selectively validate rule

I have a form where I can set the rules as required true/false depending on which button was clicked (insert or update). If all I'm using is "required" it works great.  Is there a way to add other validation rules only if the field is required?  Let me show you what I have so it can make more sense.  I added a "number" rule that only needs to apply if required=true.

The problem is that the both "number" rules trigger, even when only one of them is supposed to.

I've pasted my current iteration, but I've also tried this without any success, which sort of makes sense because I want "number" to be a rule only if the textbox is required; if not, then the number rule shouldn't be there.
  1. required: function (element) { return Insert_Clicked; },
  2. number:function (element) { return Insert_Clicked; }

Any ideas? Thanks.

  1. $(document).ready(function () {    
  2.     var Insert_Clicked = false;
  3.     var Update_Clicked = false;

  4.     $('#form1').validate({        
  5.         rules: {
  6.             // This is the NAME -- not the ID -- of the control as it appears in the browser, where the textbox is set to have a static clientid
  7.             ctl00$ContentPlaceHolder1$fvAddRequest$txtQtyOrder_i: {
  8.                 required: function (element) { return Insert_Clicked; },
  9.                 number:true
  10.             },       
  11.             ctl00$ContentPlaceHolder1$fvAddRequest$txtQtyHand_i: {
  12.                 required: function (element) { return Insert_Clicked; }
  13.             },
  14.             ctl00$ContentPlaceHolder1$fvAddRequest$ddlUnitType_i: {
  15.                 required: function (element) { return Insert_Clicked; }
  16.             },

  17.             ctl00$ContentPlaceHolder1$gvEditOrders$ctl02$txtQtyOrder_e: {
  18.                 required: function (element) { return Update_Clicked; },
  19.                 number: true
  20.             },
  21.             ctl00$ContentPlaceHolder1$gvEditOrders$ctl02$txtQtyHand_e: {
  22.                 required: function (element) { return Update_Clicked; }
  23.             },
  24.             ctl00$ContentPlaceHolder1$gvEditOrders$ctl02$ddlUnitType_e: {
  25.                 required: function (element) { return Update_Clicked; }
  26.             }
  27.         }     
  28.     });