开发者

Using a funcCall that retrieves multiple fields

Ello, I'm using jQuery-Validation-Engine and i don't know if this is currently possible but, Is there a way for you to possibly use the funcCall in a senario such as this.

I have to check a date range using 2 textboxes. I want to b开发者_JAVA百科ind funcCall[dateRangeCheck] in such a way that I can get access to 2 fields as opposed to just the one. The end result would would something like this.


dateRangeCheck = function (fields, rules, i, options) {
    if (isDate(fields[0]) && isDate(fields[1])) {
        if (!dateCompare(fields[0], fields[1])) {
         return "* Invalid Date Range";
        }
    }
 };

Or possibly all the fields that a utilizing this particular funcCall like this


dateRangeCheck = function (fields, rules, i, options) {
    for (var i=0;i<fields.length;i++)
       if(!isDate(fields[i]){
          return "* Invalid Date Range";
       }
    }
 };

Is there some way to accomplish this?


Well now jQuery-validation-engine does support date range checking. Just made the commit myself waiting for it to be reviewed. lol, But no to that second example as of now.

Here is the source. Have a nice day.

Update

The latest version does support group validation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜