views:

27

answers:

0

The valid() function states: "Checks whether the selected form is valid or whether all selected elements are valid."

Which seems to imply we can test for a group of controls using a selector (we're testing controls on a asp.net form) e.g.

$('div[id$=pnlBillingInfo] .Field input').valid()

This works if all fields are required. However, if one field requires no validation (required = false) then valid() returns false when this field is left blank.

This behavior doesn't seem correct - are we missing something? We should be able to leave these optional fields blank and still have the group of controls validate ok.

If we try to validate this optional field - the result is 'undefined' e.g.

$("#aspnetForm").validate().element('input[id$=txtBillingAddress2]')

jQuery 1.4.2

jQuery plugin Validation 1.7 (latest version)

http://bassistance.de/jquery-plugins/jquery-plugin-validation/

Thanks!