gpt4 book ai didi

javascript - Page_ClientValidate 返回 false 但没有一个验证器有错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:57:35 25 4
gpt4 key购买 nike

我正在使用 Page_ClientValidate 进行验证。

即使没有无效输入,它也返回 false。

  function PageValid() {

var valid = Page_ClientValidate('save');

alert(valid);

if (valid == true) {

$('.mydiv').hide();
}

}

此处“保存”是验证组。请帮帮我。

谢谢,拉吉比尔

最佳答案

通过ASP.NET Validation in DepthJava script page validation Page_clientValidate()

The Job of this function is to check the page is it valid if any of the validator is not valid this function return false otherwise it return true.

if (Page_ClientValidate()) {

// Page is Ok

//Submit it To The Server

return true
} else {

//Page is Not Valid

//Return False

return false

}

您可能缺少验证器上的验证设置或 js 上的其他一些错误。

您可以按照以下方式进行手动验证:

<script type="text/javascript" language="javascript">
/* Manual client-side validation of Validator Groups */
function fnJSOnFormSubmit() {
var isGrpOneValid = Page_ClientValidate("valGrpOne");
var isGrpTwoValid = Page_ClientValidate("valGrpTwo");

var i;
for (i = 0; i < Page_Validators.length; i++) {
ValidatorValidate(Page_Validators[i]); //this forces validation in all groups
}

//display all summaries.
for (i = 0; i < Page_ValidationSummaries.length; i++) {
summary = Page_ValidationSummaries[i];
//does this summary need to be displayed?
if (fnJSDisplaySummary(summary.validationGroup)) {
summary.style.display = ""; //"none"; "inline";
}
}

if (isGrpOneValid && isGrpTwoValid)
return true; //postback only when BOTH validations pass.
else
return false;
}

引用:
Page_ClientValidate() with multiple ValidationGroups - how to show multiple summaries simultaneously?
Page_ClientValidate is validating multiple times.

关于javascript - Page_ClientValidate 返回 false 但没有一个验证器有错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10169623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com