我正在使用livevalidation.js (http://livevalidation.com/)来验证表单。
这在很大程度上是有效的,但我在让它做一些我需要它做的事情时遇到了麻烦。
我有两个字段“有多少孩子”和“孩子的年龄”
基本上,我需要它来检查“孩子的年龄”中是否存在答案,如果填写了“有多少孩子”。
如果他们没有填写“有多少个孩子”,那么填写“孩子的年龄”也没有关系。
我知道如何检查状态,但我不知道如何检查它,只有在其他字段也被填写的情况下。
任何帮助都将不胜感激。
发布于 2011-04-30 21:11:46
if(
numofchildren.Presence( 'children are here', { failureMessage: "Supply come childrens!" } ) == true
&& ageofchildren.Presence( 'children have ages', { failureMessage: "no children!" } ) == true){
//do work
} https://stackoverflow.com/questions/5827099
复制相似问题