Page_ClientValidate () Question

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

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


}

The script is bound to the asp.net button by validating the expression. I have another form on my page with a specific validation group.

When I click on this button (subject to all conditions). It causes an error in another validation group. How and why is this happening? Is there any way to counter this?

It is as if Javascript is checking all fields no matter which group they are in / in

+3
source share
3 answers

You can pass a validation group as an argument, e.g.

Page_ClientValidate("valMyValGroup");
+1
source

I think you need to specify an empty group name if you do not want to check everything.

Page_ClientValidate(''); 
0
source

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

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

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

}

0
source

Source: https://habr.com/ru/post/1761124/


All Articles