[jQuery] [validate] Trouble using rules( "add", rules ) as well as setting attribute for range validations

[jQuery] [validate] Trouble using rules( "add", rules ) as well as setting attribute for range validations


I'm working on a server-side component that will generate all of my
jQuery validation rules from xml metadata, so I'm trying to
dynamically add rules one at a time.
My first attempt was to use the rules( "add", rules ) syntax, but I'm
getting an error on page load:
jQuery.data(element.form, "validator") is undefined
Here's the syntax I'm using:
$("#VerifyPassword").rules('add',{equalTo: '#UserPass'}); which seems
to be correct according to the docs.
So, I decided to try setting attributes instead, which works fine for
the equalTo. For example, this works:
$("#VerifyPassword").attr('equalTo','#UserPass');
But when trying to use attr to set a range I cannot figure out what to
pass in for the range.
I've tried:
$("#UserPass").attr('rangelength','[5,10]'); -> yeilds the message
"Please enter a value between NaN and 5 characters long."
$("#UserPass").attr('rangelength',[5,10]); --> yields the message
"Please enter a value between 5 and NaN characters long."
var theRange = [5,10]; $("#UserPass").attr('rangelength',theRange); --