Hi folks,

I couldn't find any solutions to this. I needed the validate plugin to
have validation group like functionality for use on asp.net webforms
(because asp.net only allows one form).

I'm not much a javascript programmer but I had a crack at it anyway.
After stumbling in the dark for a bit I have something (that i havent
tested much) that appears to work. Wasn't as hard as I thought it
would be :)

The syntax for defining the group like behaviour is:

valgroups : {
                    test : { buttons : [ '<%= SaveButton.UniqueID
%>' ], fields : [ '<%= Firstname.UniqueID %>', '<%= Surname.UniqueID
%>' ] },
                    foo : { buttons : [ '<%= SaveButton2.UniqueID
%>' ], fields : ['<%= Company.UniqueID %>', '<%= Postcode.UniqueID
%>' ] }
                },

The absence of the valgroups definition just validates everything. The
need for a label of the 'groups' is somewhat questionable as I don't
reference it anywhere. I didn't want to have to add onclick code or
special attributes to my buttons so I just associate the buttons
directly with the field subset.

When validating seperate groups the behaviour I've added hides all
error messages and field highlights for fields in the other groups.

You can view/download the code here: 
http://plugins.jquery.com/files/issues/jquery.validate.js__0.txt

I'd say it's likely that I've broken something but so far so good.

Reply via email to