开发者

Page_ClientValidate() Question

开发者 https://www.devze.com 2023-01-12 13:32 出处:网络
function Subscribe() { if (typeof (Page_ClientValidate) == \'function\') { Page_ClientValidate(); } if (Page_IsValid) {
function Subscribe() {
    if (typeof (Page_ClientValidate) == 'function') {
        Page_ClientValidate();
    }

    if (Page_IsValid) {
        // do something
       CheckUser();            
    }


}

The script is tied to an asp.net button with regular express开发者_高级运维ion validators. I have another form on my page with a different validation group specified.

When I click on this button (with all conditions met). It fires an error on the other validationgroup. How and why is this happening? Is there a way to counter this?

Its as if Javascript is validating all fields irrespective of which group they are from/in


You can pass the validation group as an argument like

Page_ClientValidate("valMyValGroup");


i think you have to specify an empty group name if you don't want to validate everything.

Page_ClientValidate(''); 


I managed to get it working by passing the validation group name to Page_ClientValidate.

function Subscribe() {
if (typeof (Page_ClientValidate) == 'function') {
    Page_ClientValidate('groupname');
}

if (Page_IsValid) {
    // do something
   CheckUser();            
}

}

0

精彩评论

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