使用检索多个字段的 funcCall

发布于 2024-11-06 01:57:53 字数 853 浏览 5 评论 0原文

你好,我正在使用 jQuery-Validation-Engine 我不知道这目前是否可行,但是,有没有办法让您在这样的场景中使用 funcCall 。

我必须使用 2 个文本框检查日期范围。我想以这样的方式绑定 funcCall[dateRangeCheck] 以便我可以访问 到 2 个字段,而不是仅一个字段。最终结果会是这样的。


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

或者可能是像这样利用这个特定 funcCall 的所有字段


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

有什么办法可以做到这一点吗?

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 bind 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风吹过旳痕迹 2024-11-13 01:57:53

现在 jQuery-validation-engine 确实支持日期范围检查。我自己刚刚做出了承诺,等待审核。哈哈,但目前为止第二个例子还没有。

这是源代码。祝你有美好的一天。

更新

最新版本确实支持组验证。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文