Here how it looks now:
validator : $('#new_place').validate({
errorElement: 'p',
errorPlacement: function(error, elem) {
error.addClass('error-message left');
if (elem.attr('id') != 'select_id') {
elem.parent('span').after(error);
} else {
elem.parents('div.line.categories').append(error);
};
},
meta: 'validate',
debug: true,
onsubmit: false,
highlight: function(element, errorClass) {
if ($(element).attr('id') != 'select_id') {
$(element).parents('div.field-wrapper').addClass('errors');
if ($(element).parent('span').next().length > 0) {
$(element).parent('span').next('p.error').addClass('error-
message left');
};
} else {
$(element).parents('div.line.categories').prev
('div.line').addClass('errors'); // red label
$(element).parents('div.line.categories').addClass
('errors'); // red error
};
},
unhighlight: function(element, errorClass) {
if ($(element).attr('id') != 'select_id') {
$(element).parents('div.field-wrapper').removeClass
('errors');
} else {
$(element).parents('div.line').removeClass('errors');
$(element).parents('div.line').prev
('div.line.errors').removeClass('errors');
};
}
}),
and as soon as i add errorClass: 'error-message left' to the validator
configuration - messages start piling up.
On Dec 16, 6:29 pm, Jörn Zaefferer <[email protected]>
wrote:
> Without seeing any of your code is pure guesswork to help you find the
> issue. I need to see at least the code configuring the validation plugin.
>
> Jörn
>
> 2009/12/16 eimantas <[email protected]>
>
> > Hi guys
>
> > I'm having trouble with validation plugin from bassistance.de. I have
> > custom handlers for errorPlacement, highlight and unhighlight events.
> > I also have defined custom errorElement. Error messages and validation
> > data is extracted via metadata plugin using html5 data-* attributes.
>
> > The problem is that if I define custom errorClass (which i need for
> > error message elements), the error gets added each time the field is
> > unfocused and left blank after first validation. For example:
>
> > 1) I open form and try to submit it;
> > 2) Errors are displayed;
> > 3) I focus/blur errored field;
> > 4) the error for that field is added again;
>
> > Any help would be appreciated without disclosing lots of mine code .)
>
> > Thank you in advance for taking time to answer my call for help!