Thursday, January 27, 2011

requiredfield validator is preventing another form from submitting

I have a page with many forms in panels and usercontrols, and a requiredfield validator I just added to one form is preventing all of my other forms from submitting. what's the rule that I'm not following?

  • You should be setting ValidationGroup property to a different value for each group of elements. Your validator's ValidationGroup must only be same with the control that submit its form.

  • Are you using ValidationGroups? Try assigning each control with a validation group as well as the validator that you want to use. Something like:

    <asp:TextBox ID="txt1" ValidationGroup="Group1" ruant="server" />
    <asp:RequiredFieldValidator ID="rfv1" ... ValidationGroup="Group1" />
    

    Note, if a button doesn't specify a validation group it will validate all controls that aren't assigned to a validation group.

  • Thanks for the info

0 comments:

Post a Comment