Asp – Client-Side validation with groups

asp.netclient-sidevalidation

I have several tabs that are loaded via ajax, and each one has a set of validators. I want to allow the user to change tabs only if the tab is valid

I thought setting a validationgroup to the validators and then check for the specific group like this, would work:

function validatePage(group) {
    return Page_ClientValidate(group);
}

However, when I call the function, it always returns true. Can anyone see what I'm doing wrong?

I check it like this

alert(validatePage("presentaciones"));

And I have some validators:

// (...)
<asp:TextBox ValidationGroup="presentaciones" id="txtDescription" runat="server" Text='<%# Eval("Description") %>' MaxLength="50" />
<asp:RequiredFieldValidator ID="DescriptionRequiredFieldValidator" runat="server" ControlToValidate="txtDescription" SetFocusOnError="true" ValidationGroup="presentaciones" ErrorMessage="Debe ingresar una descripciĆ³n" Display="Dynamic" />
// (...)

Best Answer

I have made groups work server-side with Page.Validate(group) but I wasn't aware this could be done client-side. Perhaps you need to implement a custom validation control that checks the status of each tab.