Raba - Defend your code RSS 2.0
# Sunday, May 14, 2006

History
In our application we created a special (user friendly) window for showing messages to the user. The window will get its data, text, buttons through the args parameter.

We will open this window using the messageBox function (this method lies in one of our JS files).

Challenge
Everyone knows the annoying default alert of ValidationSummary in ASP.NET.
Our messageBox still couldn't rid from the alert that the WebUIValidation.js is popping up on validation error.
Why? Because in this JS, Microsoft simply write alert(msg).

Solution
Today we wrote those simple lines:

window.alert = function specailAlert(msg) {
   messageBox("title", msg, button_ok, info_icon);
}

This will cause the JS parser to call our function any time the origin window.alert is running. So from now on, when the ValidationSummary will write alert("some useful message"), our method will replace the ugly gray box with our user friendly window.

 

Sunday, May 14, 2006 8:54:57 PM (GMT Daylight Time, UTC+01:00)  #    Comments [1] - Trackback
.Net | Scripting Technology

Tuesday, September 26, 2006 11:18:48 AM (GMT Daylight Time, UTC+01:00)
Testing the alert window
test
Comments are closed.
Archive
<February 2012>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910
Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2012
Shani Raba
Sign In
Statistics
Total Posts: 145
This Year: 0
This Month: 0
This Week: 0
Comments: 97
Cool Stuff
Add to Technorati Favorites
Themes
Pick a theme:
All Content © 2012, Shani Raba
DasBlog theme 'Business' created by Christoph De Baene (delarou)