我有一个使用LiveValidation扩展的Webform.我有一个条件规则,如果用户选择美国,那么州或省字段必须在州缩写列表中.
我的问题是,如果用户选择美国,然后返回并更改他们的答案,则应删除验证规则,以便他们可以输入任何旧的文本字符串.我检查了我的语法四倍,函数返回一个liveValidation对象而不是一个错误对象但是规则没有删除.任何建议将不胜感激.
这是脚本:
if($('#edit-submitted-state-or-province').length){
var field12 = new LiveValidation('edit-submitted-state-or-province', { validMessage: " ", onlyOnBlur: true });
field12.add( Validate.Presence, { failureMessage: "Please enter your state or province." } );
}
$('#edit-submitted-country').change(function() {
var stateList = new Array("","AK"..."WY");
if($("#edit-submitted-country").val() == "United States"){
field12.add( Validate.Inclusion, {within: stateList, failureMessage: "Please enter a valid 2-letter state abbreviation."});
}
else{
field12.remove( Validate.Inclusion, {within: stateList, failureMessage: "Please enter a valid 2-letter state abbreviation."});
}
});
Run Code Online (Sandbox Code Playgroud) 我需要实现以下列表样式:
01 Item 1
02 Item 2
02a Item 2a
02b Item 2b
03 Item 3
如何获取父项的计数器值以在:before子项的内容中使用?(上面例子中的02)