my js is as follows:

var validator = $('#myForm').validate({
                        onfocusout: false,
                        onkeyup: false,

                        rules: {
                                prefix: { required: true },
                                name: { required: true }
                        },

                        messages: {
                                prefix: { required: 'Please select a prefix' },
                                name: { required: 'Please provide your name' }
                        },

                        errorClass: 'formError',
                        highlight: function(element, errorClass) {
                                $(element.form).find('label[for=' + element.id +
']').addClass(errorClass);
                        },
                        unhighlight: function(element, errorClass) {
                                $(element.form).find('label[for=' + element.id +
']').removeClass(errorClass);
                        }
                });

and my html:

<fieldset>
  <label for="prefix">*Prefix:</label>
  <input id="prefix" name="prefix" type="text" class="field" />
</fieldset>

<fieldset>
  <label for="name">*Name:</label>
  <input id="name" name="name" type="text" class="field" />
</fieldset>

and I am using jquery 1.2.6 with jquery validation 1.4

When I submit with errors both labels get the errorClass attached
which is what I want. But when I fix the errors and submit again, the
labels disappear and it seems are getting a style="display;none"
instead of running the unhighlight method. Also, if I put an alert
statement inside the unhighlight method it seems once you submit with
no errors each corrected field spits out the alert twice. Any ideas?
How do I get the unhighlight to remove the class instead of making the
label disappear?

Reply via email to