jQuery Validate - display one warning for the same types of errors
Hi,
I have a simple form that has several input elements that are required:
- $("input").each(function(index, elem) {
- var rules = {
- required:true
- }
- $(elem).rules("add", rules);
- });
And I want to place all error messages within div:
- <div id="errorContainer" class="inputGreska">
- There are some errors. Please correct the following:
- <ul id="errorLabelContainer"></ul>
- </div>
So, I did the following:
- $("#forma").validate({
- errorClass: "red",
- errorContainer: "#errorContainer",
- errorLabelContainer: "#errorLabelContainer",
- wrapper: "li",
- errorElement: "div"
- });
The problem is the following:
If the user forgets to fill more than one input - within error container there will be the same warnings repeated. So, if the user forgets to fill 3 fields, there will be:
- This field is required.
- This field is required.
- This field is required.
Is it possible to show just one error message, like this:
- Fields marked by asterisks (*) are required
no matter how many elements the user has forgotten to fill.
Thank you.