jQuery validate不能按预期工作。这可能是什么原因?

时间:2018-10-21 20:52:21

标签: jquery

这真的很奇怪。

我使用jquery验证,看起来所有代码都是正确的,但是它不起作用。 没有错误,没有任何消息,简单无所事事,而其他验证规则也能正常工作。

library(raster)
library(sp)

#inspect initial polygon output for number of features
poly       #e.g., features: 360

#aggregate initial polygon output into single multi-part features
#this solves some unrealistic feature separation which resulted from
#the raster to polygon conversion
polya = aggregate(poly, dissolve = TRUE)
polya      #e.g., features: 1

#disaggregate multi-part polygon into separate features
polyd <- disaggregate(polya)
polyd      #e.g., features: 228

#apply a negligible buffer distance around polygon features to combine features 
#that are only connected by one raster corner (and therefore counted 
#incorrectly as distinct features after the above steps)
#and dissolve
polyb <- buffer(polyd, width = 0.001, dissolve = TRUE)
polyb      #e.g., features: 1

#disaggregate multi-part buffered polygon into separate features
polybd <- disaggregate(polyb)
polybd     #e.g., features: 181

我已加载了所有需要的脚本:

$("#MCFormWeb").validate({
    debug: true,

    rules: {
            MCFormTotalField: {
                  required: true,
                  number: true
        }
    }

});

它确实必须工作。可能有什么麻烦吗?

1 个答案:

答案 0 :(得分:1)

我发现了麻烦。

在我的输入字段中,我有一个id=MCFormTotalField,但它也想要name=MCFormTotalField

现在可以使用!