473,378 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

how to print all messages in a single alert box.

20
this is my validation code & i want to print all error msg's in single alert box.
please can any one send me the code 4 that
Expand|Select|Wrap|Line Numbers
  1. function validate_grid(value,id,ind)
  2. {
  3. var err_str="";
  4. if(ind==1 || ind==2)
  5. {
  6. var patt=/^([0-9]|[0][0-9]|[1][0-9]|[2][0-3])[:\.]{1} [0-5][0-9]$/;
  7. if(!patt.test(value))
  8. {
  9. mygrid.setCellTextStyle(id,ind,"background-color:yellow;");
  10. if(err_str!="")
  11. err_str+="\n"+(ind+1)+". Enter numbers and : only";
  12. else
  13. err_str=(ind+1)+".Enter numbers and : only";
  14. alert(err_str);
  15. return false;
  16. }
  17. else
  18. {
  19. mygrid.setCellTextStyle(id,ind,"background-color:white;");
  20. return true;
  21. alert(err_str);
  22. }
  23. }
  24. else if(ind==3 || ind==4)
  25. {
  26. var patt=/^[0-9]+[\.]?[0-9]{0,2}$/;
  27. if(!patt.test(value))
  28. { mygrid.setCellTextStyle(id,ind,"background-color:yellow;");
  29. if(err_str!="")
  30. err_str+="\n"+(ind+1)+". Enter floating type values only........";
  31. else
  32. err_str=(ind+1)+".Enter floating type values only........";
  33. alert(err_str);
  34. return false;
  35. }
  36. else
  37. {
  38. mygrid.setCellTextStyle(id,ind,"background-color:white;");
  39. return true;
  40. alert(err_str);
  41. }
  42. }
  43. else if(ind==6)
  44. {
  45. var patt=/^[0-9]{2}[\-][a-z]{3}[\-][0-9]{4}$/i;
  46. if(!patt.test(value))
  47. {
  48. mygrid.setCellTextStyle(id,ind,"background-color:yellow;");
  49. if(err_str!="")
  50. err_str+="\n"+(ind+1)+".Enter Date";
  51. else
  52. err_str=(ind+1)+".Please enter Date";
  53. alert(err_str);
  54. return false;
  55. }
  56. else
  57. {
  58. mygrid.setCellTextStyle(id,ind,"background-color:white;");
  59. return true;
  60. alert(err_str);
  61. }
  62. }
  63. }
  64.  
Jan 13 '12 #1
6 3079
Dormilich
8,658 Expert Mod 8TB
alert err_str at the end of the function

PS. /^(\d|[01]\d|2[0-3])[:.] [0-5]\d$/
Jan 13 '12 #2
narinas
20
no im not getting it
Jan 13 '12 #3
Instead of using this code (alert(err_str);) in all loop, move this at the end of the function.
Jan 13 '12 #4
narinas
20
i did it but is showing alert as undefined.
Jan 14 '12 #5
Dormilich
8,658 Expert Mod 8TB
if there is no error (hence no error string) you must not use alert().
Jan 14 '12 #6
narinas
20
il get error msg when the validation is false so if all the indexes get errors error msg will display & i need all the msg's to be displayed in a single alert box.
Jan 15 '12 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Darren Dale | last post by:
I am using Emacs Python mode, and my project involves reading large datafiles and processing large arrays. I have some code that reports the progress during these time consuming processes. It works...
1
by: Simon Wigzell | last post by:
self.print() or window.print() don't work on Mac OSX with Mac IE? Any work around? I've googled this without luck and tried to find a mac or browser compatibility newsgroup without luck. Any...
2
by: Hans | last post by:
Hi! I have an asp application where I use a lot of javascript for validations etc and as it is today I use alert, confirm and prompt dialogs. Now we are adding support for unicode and I have...
12
by: eduardo.padoan | last post by:
I'm reading about "high order messages" in Ruby by Nat Pryce, and thinking if it could be util and if so, if it could be done in Python. Someone already tried? References:...
5
by: Robert | last post by:
I have this set as the onclick event procedure for a command button on a form: Private Sub cmdPrintRecord_Click() Dim strReportName As String Dim strCriteria As String strReportName =...
1
by: Paul Y | last post by:
Does anyone know how to print a single line to a printer in C# without generating a page advance? Thanks
0
by: Paul | last post by:
Occasionally my users will try to perform an action and be presented with an exception raised directly from SQL Server, in example: SET @err = 'a user-friendly error condition message'...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
0
by: John Dalberg | last post by:
I have tens of datatables showing in the dataset designer. Is there a way to scale to print everything in a single page in the designer? Or a way to print everything in pages so I can stitch the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.