473,698 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript validation

I have a method that I use for Javascript validation (see below). What
I want to do is change the alert title, buttons, icon etc. Does anybody
know the correct syntax to do this?

private void Gen_Alert(strin g Key, string msg)
{
string str = "";
str += "<script language='javas cript'>";
str += "alert('"+msg+" ')";
str += "</script>";
RegisterStartup Script(Key, str);
}
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Dec 13 '05 #1
3 1722
You can't. There are several pre-defined functions in JavaScript that do
similar things. The alert() function simply pops up a MessageBox with an OK
button on it. The confirm() function pops up a MessageBox with an OK and
Cancel button, and returns true if OK is clicked, and false if Cancel is
clicked. The propmt() function pops up a MessageBox with a text box and an
OK button, and returns the string entered into the text box.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.

"Mike P" <mi*******@gmai l.com> wrote in message
news:uf******** ******@TK2MSFTN GP14.phx.gbl...
I have a method that I use for Javascript validation (see below). What
I want to do is change the alert title, buttons, icon etc. Does anybody
know the correct syntax to do this?

private void Gen_Alert(strin g Key, string msg)
{
string str = "";
str += "<script language='javas cript'>";
str += "alert('"+msg+" ')";
str += "</script>";
RegisterStartup Script(Key, str);
}
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***

Dec 13 '05 #2
Kevin,

Thanks for the info about confirm() and prompt(), they may come in
useful!
Cheers,

Mike
*** Sent via Developersdex http://www.developersdex.com ***
Dec 13 '05 #3
You're quite welcome, Mike. I probably should have mentioned another, more
difficult alternative, which is to design a popup that does whatever you
need. It is more difficult because, for example, many browsers don't allow
popups. This can be overcome, however, by the use of an
absolutely-positioned div with a zIndex higher than the rest of the page.
Making it look like a dialog box is somewhat problematic, and unlike a
regular popup, its position is nailed to the position of the window below
it. It also requires a good bit of DHTML (JavaScript/HTML/CSS) programming
to use it, but if you design it well, it can be re-used in the same (and
other) web applications. The greatest difficulty with this sort of solution
is making it look and behave more or less the same in all browsers. But it
can certainly be done.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.

"Mike P" <mi*******@gmai l.com> wrote in message
news:OL******** ********@TK2MSF TNGP15.phx.gbl. ..
Kevin,

Thanks for the info about confirm() and prompt(), they may come in
useful!
Cheers,

Mike
*** Sent via Developersdex http://www.developersdex.com ***

Dec 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2683
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one function to verify the name fields, age, email and gender. My question is: if I create a function for each field like the code below, what would be the best way to organize the functions and call them? Would I need one main function and place...
9
4025
by: tzigone | last post by:
hello, i use asp.net validation controls in my site. i wonder whether usin javascript validation will fasten page load speed? there are currently lots of requiredfieldvalidator now is it better t use 1 javascript instead of these validators tzigon ----------------------------------------------------------------------- Posted via http://www.forum4designers.co -----------------------------------------------------------------------
111
14388
by: Retlak | last post by:
The recommended (on dozens of websites) and effective (works in Netscape, MSIE, Mozilla, probably others) way to detect if a browser has Javascript turned off is to put this in the <head>: <noscript> <meta http-equiv="refresh" content="1;url=http://yourURL/nojscript.html"> </noscript> This redirects to a doc which typically says "You need to enable
2
1453
by: GIMME | last post by:
Background ... I've created a web application that allows a user to create an HTML application from IE. The application itself creates an XML representation of a XHTML form. The XHTML representation can be saved as a string and recreated. (The application also has a crude workflow aspect - so XMHTML forms can be created and assigned a workflow. Forget I said anything about
5
2135
by: Allan M. | last post by:
I have a series of select boxes that must be populated client side, because they interact with each other. The design specification calls for these boxes to be updated without having to make a roundtrip to the server. The codebehind seems to be unaware of select box members populated via javascript. So, I'm having to create my own state management solution, (i.e. rewriting the VIEWSTATE mechanism) to persist the state of these select...
5
2643
by: | last post by:
Hi all, Has anyone been able to write some custom javascript on the onclick event of submit button to do certain things like disable submit button, only submit form once etc. This was a breeze in 1.1 since I could edit the .js file. Now in 2.0 I can no longer do this. Also, my code would have to be called after all client-side validation was done and was successful. Any ideas? TIA!
8
3667
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
27
4745
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it appears that the data goes straight to the processing page, rather than the javascript seeing if data is missing and popping up an alert. I thought it may be because much of the form is populated with data from the db (lists, etc.), but when I leave...
6
3283
by: Peter Afonin | last post by:
Hello, I'm creating an application in ASP.NET 1.1. I need to check whether at least one checkbox in my datagrid has been checked. To do this, I'm using Javascript - I'm adding this code to Page_Load event: Dim iCount As Int32 Dim sClientSideValidate As New StringBuilder iCount = dgReport.Items.Count For i As Int32 = 2 To iCount + 1
5
1911
by: Peter Afonin | last post by:
Hello, I'm not an expert in Javascript, so I'm seeking an advice. As I mentioned in my previous post, I use Javascript to check whether at least one checkbox in the datagrid has been checked. I have to use Stringbuilder to do this: Dim iCount As Int32 Dim sClientSideValidate As New StringBuilder
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.