views:

78

answers:

1

Hi there

How do i (using jquery validation) put all the messages in a div tag but leave the errors next to the input field?

At the moment i seem to be only able to have one or the other.

For the Div tag errors i have used errorLabelContainer: but if also try to use errorPlacement: to put a message/image next to the input box it does nothing.

Is it possible to use errorPlacement to put the error in more than one place?

for an example look at https://www.which.co.uk/login just submit the form. You get the errors at the top of the page as well as errors next to the required field. As far as i can see from there code, they have re-written the validator.

Regards, Pete

A: 

try http://stackoverflow.com/questions/285428/jquery-validation-how-to-display-error-container-only-when-submitting

it worked for me.

my code:

        errorElement: "div",
        errorContainer: container,
        errorClass: "errorInValid",       
        errorPlacement: function(error, element){
            var errorClone = error.clone();
                        $("#ErrorStrip").append(errorClone);
                        error.insertAfter(element).bind("hide", function(){
                                errorClone.hide();
                        });
                },

Regards, Peter

Peter