0

work ok:

errorPlacement:
                function(error, element) {
                    error.appendTo( element.parent());                         
                },

fail:

errorPlacement:
                function(error, element) {
                    error.appendTo( element.parent()); 
                    $(element).prop("title", error.text());
                },

With second snippet I see only the first error. For example I have input that is "required" and "number" - submit form - required error is shown - fill in letters - required error is shown.

Dubbuging the errorPlacement I can see that error DOM is always the same.

Thanks in advance for any help!

PS: Goal: I want to show errors as tool-tips.

2
  • So, you want to show errors in tooltips, fine (even if it is not a very good idea from a UI standpoint IMHO - validation messages should be as visible as possible, since you want the user to realize his mistake in order for him to correct it, hover tooltips don't do this well). You're setting the title property of the invalid element to achieve that. But are you reverting this action in a success callback if/when the element becomes valid again? Commented May 25, 2012 at 20:04
  • Together with tool-tip I use styles to show user their mistakes. Can you tell what should I do inside success? Thanks! Commented May 25, 2012 at 21:13

2 Answers 2

1

this Plugin may help you: http://jquery.dop-trois.org/walidate/

There it's possible to define a lot of callback-functions. For example: if sth is invalid or valid ..

So you can develop your own tooltips ;)

Sign up to request clarification or add additional context in comments.

Comments

0

Do

element.attr("title", error.text());

instead of

$(element).prop("title", error.text());

element is already a jquery element in the jquery validate plugin: http://jqueryvalidation.org/validate

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.