Looks like you need a custom method for that. The dependency checking
is useful to make a field optional based on a condition.

For writing custom methods:
http://docs.jquery.com/Plugins/Validation/Validator/addMethod

Jörn

On Thu, Oct 9, 2008 at 4:02 PM, alivemedia <[EMAIL PROTECTED]> wrote:
>
> I need to make sure that 1 field os less than the other so I am using
> the dependency callback feature and it's working but I cannot get an
> error message to display - anyone get this to work?
>
> Here is my code:
> $(document).ready(function(){
>    $("#AddPartner").validate({
>        rules: {
>        GlobalDiscount: {
>          required: function(element) {
>            if ($("#GlobalDiscount").val() <= 20) { alert('passed');
> return true } else { alert('falied'); return false }
>            if ($("#GlobalDiscount").val() <= $
> ("#ComissionSplit").val()) { alert('passed'); return true } else
> { alert('falied'); return false }
>          }
>        },
>        ComissionSplit: {
>          required: function(element) {
>             if ($("#ComissionSplit").val() <= 20) { alert('passed');
> return true } else { alert('falied'); return false }
>          }
>        }
>      },
>      messages: {
>        ComissionSplit: { dependency: "Comission plit must be less
> than 20"   },
>        GlobalDiscount: { dependency: "Global Discount must be less
> than your Comission Split"    }
>      }
>    });
> });
>

Reply via email to