How can I show both individual error messages and summaries for the jQuery plugin?
I actually found, but it uses only a few hooks, but I do not know where to start from.
I had to show individual error messages, but I must display the summary in a alert box to submit, and the plugin can be found.
Just got to know that, thanks for the code of Dawood, and on my follow up question - the warning box would be "First name: Please enter a valid first name".
Code below:
$ (document) .ready (function () {var presented = false; ('.selector') valid ({showErrors:. (Error map, error (list) {var ("submit") {var summary = "You have the following errors: \ n"; $ .ee (error map, function (key, value) {summary + = key + ': '+ Value + "\ n";}); Alert (summary); Submit Ted = Incorrect;} This.defaultShowErrors ();}, Invalid Handler: Function (form, verifier) {submitted = true;}});} );
After
adds the associated question, showErrors
callbackWhenever errors are shown I can use it to make a summary of it and alert it. After this you can call this.defaultShowErrors to display the normal person error message () < / Code>.
The default showErrors are called for a lot of events (KeyUp, Blur, etc.) if sent. You can disable either, or invalidHandler
method, which is only an ama New form is submitted.
Example:
$ (document) .ready (function () {var submit = false; ('.selector') Validate ({showErrors: function (errorMap , ErrorList) {if (submit) {var summary = "You have the following errors: \ n"; $ .Each (errorList, function) {summary + = "*" + this.message + "\ n";} ); Warning (summary); submitted = false;} this.defaultShowErrors ();}, invalidHandler: function (form, verifier) {submitted = true;}});});
See the complete list of options that can be sent to valid
method.
Comments
Post a Comment