views:

29

answers:

3
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 expression 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

A: 

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

Page_ClientValidate(''); 
lincolnk
+1  A: 

You can pass the validation group as an argument like

Page_ClientValidate("valMyValGroup");
Fahad
A: 

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();            
}

}

Kenyana
since Fahad and I both provided the correct answer to your situationm, it's appropriate to select one rather than provide your own repeating what has already been said.
lincolnk