|M| 想更改RegularExpressionValidator控件添加一个判断是否不为空的功能,大家帮看看
下面是生成的HTML在哪里加一段js可以让当T1为空时返回false
谢谢
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head> <title>
无标题页
</title> </head>
<body>
<form name= "form1 " method= "post " action= "Default.aspx " onsubmit= "javascript:return WebForm_OnSubmit(); " id= "form1 ">
<div>
<input type= "hidden " name= "__EVENTTARGET " id= "__EVENTTARGET " value= " " />
<input type= "hidden " name= "__EVENTARGUMENT " id= "__EVENTARGUMENT " value= " " />
<input type= "hidden " name= "__VIEWSTATE " id= "__VIEWSTATE " value= "/wEPDwUJMTA3MzgzNDYzZGR7cA39GfTp6FeOknPakCxFaPbt4w== " />
</div>
<script type= "text/javascript ">
<!--
var theForm = document.forms[ 'form1 '];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script>
<script src= "/Web/WebResource.axd?d=nP-B40yeBbsJrm4QuiEHMg2&t=633042217540000000 " type= "text/javascript "> </script>
<script src= "/Web/WebResource.axd?d=lSva9Ufyi4BtNn1ru4fVrbhqXLr_4gibY_Z6iF3ERy81&t=633042217540000000 " type= "text/javascript "> </script>
<script type= "text/javascript ">
<!--
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function " && ValidatorOnSubmit() == false) return false;
return true;
}
// -->
</script>
<input name= "T1 " type= "text " value= "2 " id= "T1 " />
<input type= "submit " name= "Button1 " value= "Button " onclick= "javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("Button1", "", true, "", "", false, false)) " id= "Button1 " />
<span id= "RegularExpressionValidator1 " style= "color:Red;visibility:hidden; "> * </span>
<script type= "text/javascript ">
<!--
var Page_Validators = new Array(document.getElementById( "RegularExpressionValidator1 "));
// -->
</script>
<script type= "text/javascript ">
<!--
var RegularExpressionValidator1 = document.all ? document.all[ "RegularExpressionValidator1 "] : document.getElementById( "RegularExpressionValidator1 ");
RegularExpressionValidator1.controltovalidate = "T1 ";
RegularExpressionValidator1.errormessage = "* ";
RegularExpressionValidator1.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid ";
RegularExpressionValidator1.validationexpression = "\\d ";
// -->
</script>
<div>
<input type= "hidden " name= "__EVENTVALIDATION " id= "__EVENTVALIDATION " value= "/wEWAwLQw/HqDQLs7+btDAKM54rGBksuGpp9SO367FJ2k1wbfkN6VQc7 " />
</div>
<script type= "text/javascript ">
<!--
var Page_ValidationActive = false;
if (typeof(ValidatorOnLoad) == "function ") {
ValidatorOnLoad();
}
function ValidatorOnSubmit() {
if (Page_ValidationActive) {
return ValidatorCommonOnSubmit();
}
else {
return true;
}
}
// -->
</script>
</form>
</body>
</html>
[解决办法]
不是有专门的判断空值的验证控件吗?
[解决办法]
楼主注册那么多帐号要多少时间啊?
[解决办法]
就是说T1你有要验证不能为空,又要验证匹配,是这样吗?如果是的话
那么正则修改一下就可以既验证匹配又能验证是否空了~
[解决办法]
直接有验证控件的啊~~RegularExpressionValidator自定义一个正则^\S+$就可以了
[解决办法]
必须用两个控件
[解决办法]
必须用两个控件
[解决办法]
在函数ValidatorCommonOnSubmit里面
[解决办法]
学习了
[解决办法]
url重写了。2005好像提供不少源码。但不知道是否有
[解决办法]
<input name= "T1 " onblur= "if(this.value==null){alert( 'T1 is null ')} " type= "text " value= "2 " id= "T1 " />
[解决办法]
其实不太明白楼主的意思!
你又是想改控件?
------解决方案--------------------
应该可以
那个控件我没用过1
都自己来
[解决办法]
up