开发者

Working with livevalidation.js

I am using livevalidation.js (http://livevalidation.com/) to validate a form.

this mostly works but I am having trouble getting it to do something I need it to do.

I have two fields "how many children" and "ag开发者_如何学JAVAe of children"

Basically, I need it to check for presence of answer in "age of children" if "how many children" is filled out.

If they have not filled out "how many children", then it does not matter if "age of children" is filled out.

I know how to check for presence, but I don't know how to check for it ONLY IF the other field is also filled out.

Any help would be greatly appreciated.


if(
numofchildren.Presence( 'children are here', { failureMessage: "Supply come childrens!" } ) == true 
&& ageofchildren.Presence( 'children have ages', { failureMessage: "no children!" } ) == true){

//do work 
} 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜