Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How to display multiple validation summary messages in one message box using java script, Is it possible???? please suggest me..

Thanks in Asdavnce.
Posted
Updated 12-Mar-14 20:54pm
v2
Comments
Aravindba 13-Mar-14 2:57am    
pls cleary mention

ASP.NET supports this out of the box. We have ASP.NET ValidationSummary Control[^] which can be used here. Check the link. More readings - Google search - validation summary in asp.net[^]
 
Share this answer
 
Comments
VICK 13-Mar-14 5:16am    
To use asp validation controls, place the validation summary, than validators for the each field which you want to validate, assign a Target Control ID and so on.

while in the posted solution above, you just have to add jquery reference once in the head tag, and than just add an attribute in the existing HTML content and that's it..

So what is more time saving??
Ankur\m/ 13-Mar-14 6:08am    
It is about performance and not time saving. Adding jQuery and plugin script files add to the total download time of the website. Plus the plugin contains many other features which is not required. A simple validation control or javascript method will be way too faster.
VICK 13-Mar-14 6:15am    
Well.Agreed to some extent.. @ Ankur :)
VICK 13-Mar-14 5:17am    
""""Moreover, just few lines of JavaScript will do that"""

So would you be adding few lines of Java Script along with the 50 lines of validators plus a single line of validation summary for a form which contains 50 fields to validate???
Ankur\m/ 13-Mar-14 6:09am    
No, by that I meant if you do not use validation controls, it still can be done with just a few lines of JavaScript.
If I have understood you properly, you want multiple validation messages showing for a single field. Is it so??

If YES, than answer to your question and resolution to all your problems will be JQUERY Validation Engine Plugin.

You can have a further and deep look at this plugin over HERE
 
Share this answer
 
Comments
Ankur\m/ 13-Mar-14 4:24am    
Really? ASP.NET supports this out of the box. Moreover, just few lines of JavaScript will do that. Why would I need a jQuery plugin for this?
VICK 13-Mar-14 5:14am    
You can google for the benefits of JQuery over JavaScript. further have you seen this Plugin in detail?? It has a lot of pre defined validation types and its better to use a ready made robust solution rather than searching for the javascript chunks for each validation type.

Further Ankur\m/... If you have any better solution in JavaScript. Kindly Please share it here to help others.
Ankur\m/ 13-Mar-14 6:13am    
Do you know that jQuery is build upon JavaScript? Just checking if a some control is blank or a couple of other validations do NOT require using a library. I reiterate my previous comment - Just Javascript method / validation controls method will be much faster. Moreover validation controls also provides server side validation feature out of the box. Just check - if (Page.IsValid) and you are done. So you save many lines of code and time there.
Hope I could clarify what I meant there.
VICK 13-Mar-14 6:18am    
Well. when it comes to the large forms with a lot of validations required??

Further as it has become a common trend of present era,to perform most operations on the client side to avoid server postbacks/calls, than dont you think using the oldy server side is good idea ??
Ankur\m/ 13-Mar-14 6:30am    
Server side validation is still a MUST do thing. I can disable the JavaScript on my page and very easily pass through your validation system. That will be a big loophole in your system.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900