Just remove the required-rule. All other methods include a check to make a field optional when empty.
Jörn On Sat, Apr 11, 2009 at 7:16 PM, NobitaNobi79 <frankcheun...@gmail.com> wrote: > > Hi, I am new to jQuery. I follow the example on > http://docs.jquery.com/Plugins/Validation/Methods/email to add rules > to a form validator. When I modified the rules to email: true > (required: false), the script seems to stall there, no error message > nor a check. Can someone tell me if I am doing anything wrong here? > What I want is to let the validation pass if the optional fields are > valid when they are filled or they are left out empty. > > I can, of course add an extra script like... > if (($("#field").val() == "") || $("#field").valid()) { > optionalValid = true; > } > But it seems very redundant considering the rules: { field: {email: > true, required: false}}, with or without the default required: false > option. > > Thanks >